Java Programming Tutorial | Beginning Java programming with Hello World Example | GeeksforGeeks

Java Programming Tutorial | Beginning Java programming with Hello World Example | GeeksforGeeks


Hello viewers, welcome to GeeksforGeeks. In
this video, we will begin Java programming with Hello World Example. Lets switch to our
IDE.This is the code that would print Hello world. The first line uses the keyword class
to declare that a new class is being defined. HelloWorld is an identifier that is the name
of the class. A class is the basic building block of object-oriented programming, gradually
you will understand its meaning, for now just skip the details. The next is the main method,
In Java programming language, every application must contain a main method whose signature
is this. main method is the entry point for your application, it will the first method
that would run, and it would subsequently invoke all the other methods required by your
program. The next line of code is System.out.println(“Hello World”), This line outputs the string “Hello
World” followed by a new line on the screen. And these are the comments, a comment is a
programmer-readable explanation which are added with the purpose of making the source
code easier for humans to understand, and are generally ignored by compilers. Now lets
compile it. It shows hello world as expected. Now i will show you how to run this program
on your linux machine. Open any text editor, I am using sublime here, you may download
the same as it is one of the most popular text editor to write codes. Copy the same
code in sublime text. Save it with any name say xyz.java. I will save it on desktop. Now
open the terminal using ctrl shift t. Locate your file on terminal, as it was saved in
on desktop, i will go to desktop. So here it is. Now type javac xyz.java. A new file
Helloworld.class will be created, lets find it, yeah here it is. Now write java xyz, it
will run and It has printed hello world on the terminal, thus it is working. You can
follow the same procedure for windows, just use command line on windows. Thank you for
watching please leave us your likes and comments.

5 thoughts on “Java Programming Tutorial | Beginning Java programming with Hello World Example | GeeksforGeeks”

  1. Guys plz make an explanatory video on complete internal working of JVM with example. All the components of JVM and its purposes.

  2. As per my knowledge we have to save the java program with name we have given to Class containing Main Program
    means U had to save it as helloworld.java

  3. for running java class file, here you need to write "java HelloWorld" on the terminal. You were saying java xyz. Do notice this mistake. 2:21

Leave a Reply

Your email address will not be published. Required fields are marked *