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(); } }
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();
}
}
+ 1
zemiak
Thank you very much
0
SuperOma
Thankkk you very much♥️