hamthenormal
hamthenormal

Reputation: 921

What's difference between View view and View v?

In courses of Android Basics on Udacity, (View view) and (View v) were used interchangeably.

public void methodName(View view){}
public void methodName2(View v){}

Are they the same? I'm curious because one might act a little different than the other and they are changing the view to v to view again for a specific purpose.

Upvotes: 1

Views: 1012

Answers (3)

Omar
Omar

Reputation: 1111

Both are the object of View Class.

Have a look at Here

Upvotes: 1

Ofek Regev
Ofek Regev

Reputation: 502

both view and v are just variables name. they will both act the same. you can also write methodName3(View name) and "name" will still act the same as "view" and "v".

Upvotes: 3

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181390

Yes. They are exactly the same. The only difference is that parameter formal names are different: v and view. Use whatever you like and makes your code more readable.

Upvotes: 5

Related Questions