- 2

public class finalwithref{ final int a = 6; } public class Program { public static void main(String[] args) { final

Anyone can fix the error

13th Sep 2021, 8:08 AM
Amala Yakin
2 Answers
+ 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 } }
13th Sep 2021, 9:51 AM
Coding Cat
Coding Cat - avatar
+ 1
Please post the full code
13th Sep 2021, 11:50 AM
Atul [Inactive]