Some Basic program of java language,java practice programs for beginners
Some Basic program of java language, java practice programs for beginners
1. Addition of two number :
class Addition
{
int a,b; // intsance variable
Addition(int p,int q) //constructor
{
a=p;
b=q;
}
void show() // method for result
{
System.out.println("The Sum is : " +(a+b));
}
}
class Test
{
public static void main(String[] args)
{
Addition ob= new Addition(2,3);
ob.show();
}
}
by using this program you can perform other operation like
1. Addition of two number :
class Addition
{
int a,b; // intsance variable
Addition(int p,int q) //constructor
{
a=p;
b=q;
}
void show() // method for result
{
System.out.println("The Sum is : " +(a+b));
}
}
class Test
{
public static void main(String[] args)
{
Addition ob= new Addition(2,3);
ob.show();
}
}
by using this program you can perform other operation like
- substraction,
- multiplication,
- division
For any kind of help contact or follow me in instagram
link : click here

No comments