0

Somebody tell me what is error is 😢💔

public class Main { public class HA{ private String name; public static String shool ="neelen"; class HA(String x){ name = x; } public void display () { System.out.println("my namr is"+name+shool);} } public static void main(String[] args) { HA obj =new HA("hawa"); obj.display(); } }

12th Sep 2019, 11:55 AM
Hawaa Basheer Ali Elamin
Hawaa Basheer Ali Elamin - avatar
4 Réponses
+ 2
inner class can't be static public class Main { public class HA{ private String name; // public static String shool ="neelen"; public String shool ="neelen"; // class HA(String x){ HA(String x){ //name = x; String name = x; } // .... public static void main(String[] args) { // HA obj =new HA("hawa"); HA obj = new Main().new HA("hawa"); obj.display(); } }
12th Sep 2019, 12:16 PM
zemiak
+ 1
zemiak Thank you very much
12th Sep 2019, 1:06 PM
Hawaa Basheer Ali Elamin
Hawaa Basheer Ali Elamin - avatar
0
SuperOma Thankkk you very much♥️
12th Sep 2019, 1:06 PM
Hawaa Basheer Ali Elamin
Hawaa Basheer Ali Elamin - avatar