package Example2;
import java.util.Scanner;
public class Example2{
public static void main(String [] args){
Scanner input = new Scanner(System.in);
int num1, num2;
System.out.println(“Enter the first number”);
num1=input.nextInt();
System.out.println(“Enter the second number”);
num2=input.nextInt();
if(num1==num2){
System.out.println(“the two number are equal”);
}else{
System.out.println(“they are not equal”);
}
}
……………………………………………………………………………………………………………………………………………………………………………
Scanner Add=new Scanner(System.in);
int age, maths, english, expe;
System.out.println("enter your age ");
age=Add.nextInt();
System.out.println("enter your mathematics score ");
maths=Add.nextInt();
System.out.println("enter your english score ");
english=Add.nextInt();
System.out.println("enter your years of work experience ");
expe=Add.nextInt();
if(age>=25 && maths >=50 && english >= 50 && expe >= 2){
System.out.println("you are qualified");
}else{
System.out.println("you are not qualified");
}
………………………………………………………………………………………………………………………………………………………………………………
<html>
<head>
<title>Java Applet</title>
</head>
<body>
<applet code=”” width=”600px” height=”300px”/>
</body>
<html>
int array[][]={
{40,10,120,70,67},
{46,53,84,18,48},
{90,46,76,100,73},
{78,79,48,50,45},
{81,59,84,92,66}
};
System.out.println("the unit of milk sold from monday to friday are ");
for(int i=0; i<=4; i++){
for(int j=3;j<=4; j++){
if(j==3){
System.out.print(array[j][i] +",");
}
}
}
}
……………………………………………………………………………………………………………………………………………………………………………..
int array[][]={
{40,10,120,70,67},
{46,53,84,18,48},
{90,46,76,100,73},
{78,79,48,50,45},
{81,59,84,92,66}
};
System.out.println("Milo sold on Monday and Thursday are "+ array[0][0] + " and " + array[0][3]);
…………………………………………………………………………………………………………………………………………………………………………..
package ex1;
import java.util.Scanner;
public class Ex1 {
public void Method1(){
int a=4,b=2, sum;
sum=a+b;
System.out.println("sum is " + sum);
}
public void Method2(){
int a=4,b=2, sum;
sum=a*b;
System.out.println("sum is " + sum);
}
public void Method3(){
int a=4,b=2, sum;
sum=a-b;
System.out.println("sum is " + sum);
}
public static void main(String[] args) {
// TODO code application logic here
Ex1 Call=new Ex1();
Call.Method1();
Call.Method2();
Call.Method3();
}
}
………………………………………………………………………………………………………………………………………………………………………
package optionj;
import javax.swing.JOptionPane;
public class Optionj {
public static void main(String[] args) {
String input1=JOptionPane.showInputDialog("enter first integer");
String input2=JOptionPane.showInputDialog("enter second integer");
String input3=JOptionPane.showInputDialog("enter third integer");
int value1=Integer.parseInt(input1);
int value2=Integer.parseInt(input2);
int value3=Integer.parseInt(input3);
int sum=value1+value2+value3;
JOptionPane.showMessageDialog(null,"sum is equal " + sum);