- 2
public class finalwithref{ final int a = 6; } public class Program { public static void main(String[] args) { final
Anyone can fix the error
2 Antworten
+ 1
Write first letter of class name upper case.
Then first create an object from your class. After that you can get the attribut "a" by using obj.a
public class Finalwithref {
final int a = 6;
}
public class Program {
public static void main(String[] args) {
Finalwithref obj = new Finalwithref();
System.out.println(obj.a);
// prints 6
}
}
+ 1
Please post the full code