I am getting exception errorn in for thread main java lang error -


i beginner in java , getting error

"exception in thread "main" java.lang.error: unresolved compilation problem: "

below code:

public class second {     string name;     int age;  }  public class seco {  public static void main(string[] args) { second display = new second(); display.name = "gunwant"; display.age = 37; system.out.println(display.age); system.out.println(display.name); } } 

hello satya should put class seco in file called seco.java , class second in file called second.java or remove 'public' 'public class second' :

 class second {     string name;     int age;  }  public class seco {  public static void main(string[] args) { second display = new second(); display.name = "gunwant"; display.age = 37; system.out.println(display.age); system.out.println(display.name); } } 

this way should work


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -