aartiyadav
New Coder
Hello All, I am in learning face to java programming and to run my program at the command prompt, I downloaded the java development kit also known as JDK, and I set my windows 10 system path to:
After writing a simple Hello World program with the following format:
and running it on command prompt using
As suggested, I am using online compiler this https://www.interviewbit.com/online-java-compiler/ and the output was:
Where is the problem coming from? How can I fix it? Any suggestions?
C:\Program Files\Java\jdk-9.0.1\bin;C:\Program Files\Java\jre-9.0.1\bin
After writing a simple Hello World program with the following format:
Java:
class test{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
and running it on command prompt using
, and then writingjavac test.java
the output says:java test
I have tried compiling my simple program on an online Java compiler and everything works fine.Error: Main method is not static in class test, please define the main method as:
public static void main(String[] args)
As suggested, I am using online compiler this https://www.interviewbit.com/online-java-compiler/ and the output was:
Java:
import java.io.PrintStream;
public class test {
public test() {} public void main(String[] paramArrayOfString) {
System.out.println("Hello World!");
}
}
Where is the problem coming from? How can I fix it? Any suggestions?