Basic Java Programming Examples


Practice makes someone perfect. The best way to learn a programming language is by practicing it’s basic to higher level examples on your own. This post contains lots of java programming examples from basic concepts to higher level of Java programming like: loops, functions, classes, package, etc.

We have tested and verified all the programs in this page.

A basic java program to print “hello world!”

Output:
Java Hello World

Java Program to Print an Integer Value (User Input)

Output:
Java Print Integer Example

Java Program to Print a String (User Input)

Output:

Java Print String Example

We have already learned some basic java program and it’s time to learn some advanced. In the next Basic java programming example, we will take two integers as input from the user and print the addition of those two number.

Java Program to Calculate Addition of Two Numbers

Output:

Java Program Addition of Two Number

Close Menu