It is said that the best way to learn swimming is to jump into the water right away. Similarly, the best way to learn a programming language is to start coding straight away. Let us start our study of Java programming in an informal way. Let us write a simple Java program and run it.
In our first Java program, we will find the area of a circle with radius 5.
Problem: Write a program to find area of a circle with radius 5.
Solution: See Program 3.1.
PROGRAM 3.1 Area of a Circle
public static void main( String args )
int r ;
r = 5 ;
System.out.println(3.14 * r * r);
If you run the program, you will get the following output.