I can't run a Java program -


i starting learn java. followed tutorial on how install it. checked typing "javac"(without quotation marks) in cmd if works. , yes gives whole list of text means supposed work, right?

this java code:

class apples{     public static void main(string args[]) {         system.out.printin("hello youtube");     } } 

i saved in folder called 'test' in c drive. typed in cmd:

cd \ dir 

now lists in c drive , 1 of them test

cd test dir 

now lists in test , 1 of them 'youtube.java'(the file named), type

javac youtube.java 

this doesn't work gives me:

youtube.java:3: error: cannot find symbol
system.out.printin("hello youtube");
symbol: method printin(string)
location: variable out of type printstream
1 error

can me out this?

you have typo in call. change

system.out.printin("hello youtube");  // capital 'i' 

to

system.out.println("hello youtube");  // lowercase 'l' 

and has been mentioned already, in java, public class in file must match filename.


Comments