I can't run a Java program

前端 未结 2 1373
野性不改
野性不改 2021-01-24 07:02

I was starting to learn Java. I followed the tutorial on how to install it. I also checked by typing \"javac\"(without the quotation marks) in cmd if it works. And yes it gives

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-24 07:33

    The name of the class must match the filename.

    You should use

    public class Youtube{
    

    in your code(as class names are capitalized) and call the file Youtube.java.

    Also you used In instead of ln.

    Use:

    System.out.println(
    

    which means "print line to System.out".

提交回复
热议问题