Logo

dev-resources.site

for different kinds of informations.

Day 4 - Dec 23 -->java simple program

Published at
1/1/2025
Categories
java
beginners
program
payilagam
Author
vimala jeyakumar
Categories
4 categories in total
java
open
beginners
open
program
open
payilagam
open
Day 4 - Dec 23 -->java simple program

Step by Step procedure:
step 1: First type the code in text editor
step 2: After typing the code press ctrl+s
step 3: Pop up will click the documents and create new folder with name B14
step 4: Next file is name is most important. The class name as file name and file name should be saved in .java
step 5: Next open in terminal and type [ls] to view the list of documents
step 6: Now go to the files,Open documents folder[B14] and right click the curser and open in terminal
step 7: The terminal will be opened type the command javac First.java ,It will ask to install jdk in that choose the option yes.
-> After that list of jdk will appear in that select and copy sudo apt install default - jdk.
-> Please wait for few minutes until it gets completed
step 8: Then type the command java filename
step 9: Now click the enter the output will be diplay.

program:
Source code:
public class First
{
public static void main(String[] args)
{
System.out.println("Welcome To Java");

}
}
output:
Welcome To Java
Image description

Task
public class second
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
Output:
Hello World

Image description

Featured ones: