Welcome to our Community
Wanting to join the rest of our members? Feel free to sign up today.
Sign up

Basic Java programs for beginners

WalterThor

Noobie
Nov 6, 2020
10
700
  • Java Program to find the area of a circle
Java:
public class Main {

    public static void main(String[] args) {
    System.out.println("Enter the radius of the circle to find it's area:");
    Scanner input= new Scanner(System.in);
    int a=input.nextInt();
    float  area= 3.14f* a*a;
    System.out.println ("The area of the given circle is: "+area);
    }
}


 
To create classes or objects
public class MyClass {
int x = 10;
public static void main(String[] args) {
MyClass myObj1 = new MyClass();
MyClass myObj2 = new MyClass();
System.out.println(myObj1.x);
System.out.println(myObj2.x);
}
}
You can check out more such tutorials on huboftutorials.com. Not only Java but you can find WordPress, HTML, CSS projects. One such is Student Result Management System using PHP and MySQL.
 

Sponsored