While writting a java program make sure you file name should be same as your Class name , and file name should be saved with extension .java
Java hello program is a basic program to represent to print Simple output in Java
Example
File name : Simpleprint.java
public class Simpleprint
{ //Simpleprint is name of class
public static void main(String args[])
{
System.out.println("Hello Java");// this display output written in " "
System.out.println("Jai Shree krishna");
}
}
To run Java file open command prompt and first go to path of yor file then run .java file with command Javac after the type java and class name in .java file and java code will excute
Output:
Java hello program is a basic program to represent to print Simple output in Java
Example
File name : Simpleprint.java
public class Simpleprint
{ //Simpleprint is name of class
public static void main(String args[])
{
System.out.println("Hello Java");// this display output written in " "
System.out.println("Jai Shree krishna");
}
}
To run Java file open command prompt and first go to path of yor file then run .java file with command Javac after the type java and class name in .java file and java code will excute
Output:
output |
No comments:
Post a Comment