Amazon Interview Question
Jr. Software EngineersCountry: United States
two parts will prevent any compiling:
void static f2(){y=35;}
should be
static void f2(){y=35;}
That's just testing if you know the syntactic restrictions of the language.
Also, y must be declared as a static variable, as it must be instantiated on compile to be accessible via operation from f2.
Additionally, just nit-picking on style, but the class should have its first letter of the name capitalized (A in this case)
- Vir Pratap Uttam April 12, 2015