For All the JAVA Practical programs are available here.
HelloWorld.java
/**
* HelloWorld.java
*
* @Panorama Infocom Pvt. Ltd.
* @1.0
*/
public class HelloWorld
{
public static void main(String args[])
{
// put your code here
System.out.println("Hello World");
}
}
* HelloWorld.java
*
* @Panorama Infocom Pvt. Ltd.
* @1.0
*/
public class HelloWorld
{
public static void main(String args[])
{
// put your code here
System.out.println("Hello World");
}
}
Addition.java
import java.io.BufferedReader;
import java.io.*;
/**
* This class will add the two numbers entered by the user
*
* @Pipl
* @1.1
*/
public class Addition
{
public static void main(String args[]) throws IOException
{
int a = 0;
int b = 0 ; //Define two variable to hold the value.
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
System.out.print("Please Enter the value of Variable 1 ");
a = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 2 ");
b = Integer.parseInt(br.readLine());
//Lets to the addition
int z = a + b;
//Print the result
System.out.println("Sum of " + a + " and " + b + " is = " + z );
}
}
import java.io.*;
/**
* This class will add the two numbers entered by the user
*
* @Pipl
* @1.1
*/
public class Addition
{
public static void main(String args[]) throws IOException
{
int a = 0;
int b = 0 ; //Define two variable to hold the value.
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
System.out.print("Please Enter the value of Variable 1 ");
a = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 2 ");
b = Integer.parseInt(br.readLine());
//Lets to the addition
int z = a + b;
//Print the result
System.out.println("Sum of " + a + " and " + b + " is = " + z );
}
}
Calculator.Java
import java.io.BufferedReader;
import java.io.*;
/**
* Write a description of class Calculator here.
*
* @Pipl
* @1.1
*/
public class Calculator
{
public static void main(String args[]) throws IOException
{
int a = 0;
int b = 0 ; //Define two variable to hold the value.
int z;
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
System.out.print("Please Enter the value of Variable 1 ");
a = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 2 ");
b = Integer.parseInt(br.readLine());
z = a + b;
System.out.println(" Sum of " + a + " and " + b + " is = " + z);
z = a - b;
System.out.println("Subtraction of " + a + " and " + b + " is = " + z);
z = a * b;
System.out.println("Multiplication of " + a + " and " + b + " is = " + z);
z = a / b;
System.out.println("Division of " + a + " and " + b + " is = " + z);
z = a % b;
System.out.println("Reminder of " + a + " and " + b + " is = " + z);
}
}
import java.io.*;
/**
* Write a description of class Calculator here.
*
* @Pipl
* @1.1
*/
public class Calculator
{
public static void main(String args[]) throws IOException
{
int a = 0;
int b = 0 ; //Define two variable to hold the value.
int z;
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
System.out.print("Please Enter the value of Variable 1 ");
a = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 2 ");
b = Integer.parseInt(br.readLine());
z = a + b;
System.out.println(" Sum of " + a + " and " + b + " is = " + z);
z = a - b;
System.out.println("Subtraction of " + a + " and " + b + " is = " + z);
z = a * b;
System.out.println("Multiplication of " + a + " and " + b + " is = " + z);
z = a / b;
System.out.println("Division of " + a + " and " + b + " is = " + z);
z = a % b;
System.out.println("Reminder of " + a + " and " + b + " is = " + z);
}
}
Average.java
import java.io.BufferedReader;
import java.io.*;
/**
* Average class calculates the average of 3 numbers
*
* @author PIPL
* @version 1.0
*/
public class Average
{
public static void main(String args[]) throws IOException
{
int a = 0;
int b = 0 ;
int c = 0;
double z = 0;
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
System.out.println("Please Enter the value of Variable 1 ");
a = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 2 ");
b = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 3 ");
c = Integer.parseInt(br.readLine());
z = ( a + b + c)/3.0;
System.out.print("Average of numbers = " + z );
}
}
import java.io.*;
/**
* Average class calculates the average of 3 numbers
*
* @author PIPL
* @version 1.0
*/
public class Average
{
public static void main(String args[]) throws IOException
{
int a = 0;
int b = 0 ;
int c = 0;
double z = 0;
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
System.out.println("Please Enter the value of Variable 1 ");
a = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 2 ");
b = Integer.parseInt(br.readLine());
System.out.println("Please Enter the value of Variable 3 ");
c = Integer.parseInt(br.readLine());
z = ( a + b + c)/3.0;
System.out.print("Average of numbers = " + z );
}
}