i wrote following piece of code in sublime text on macbook pro. saved file inside java folder on desktop. when tried compile program , tried execute it, getting fallowing error message " error: not find or load main class animals ". me in compiling , running program
package forest; class animals{ public static void main(string[] args) { animals s = new animals(); sring[] s2 = s.getallanimals(); } public string[] getallanimals() { string[] s1= {"lion", "elephant", "tiger","deer","wolf","dinosar"}; return s1; } }
make class animal public , rename file animal.java
Comments
Post a Comment