-1

I was just experimenting with variable names when I realized this:-

int n; //this is a valid name
int .n; //this is a invalid name
int ..n; //this is a invalid name
int ...n; //this is a valid name
Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60

1 Answers1

1

The special token ... is to declare var-args parameters in method signatures, as in

void foo(String... bars){}

So in your example, it gets parsed differently (as int... n), and is not considered part of the variable name.

But it is still invalid syntax, comparable to int +n; or int (n;, because the token does not make sense here.

Thilo
  • 257,207
  • 101
  • 511
  • 656