package Example2;
import [Link];
public class Example2{
public static void main(String [] args){
Scanner input = new Scanner([Link]);
int num1, num2;
[Link](“Enter the first number”);
num1=[Link]();
[Link](“Enter the second number”);
num2=[Link]();
if(num1==num2){
[Link](“the two number are equal”);
}else{
[Link](“they are not equal”);
}
}
……………………………………………………………………………………………………………………………………………………………………………
Scanner Add=new Scanner([Link]);
int age, maths, english, expe;
[Link]("enter your age ");
age=[Link]();
[Link]("enter your mathematics score ");
maths=[Link]();
[Link]("enter your english score ");
english=[Link]();
[Link]("enter your years of work experience ");
expe=[Link]();
if(age>=25 && maths >=50 && english >= 50 && expe >= 2){
[Link]("you are qualified");
}else{
[Link]("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}
};
[Link]("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){
[Link](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}
};
[Link]("Milo sold on Monday and Thursday are "+ array[0][0] + " and " + array[0][3]);
…………………………………………………………………………………………………………………………………………………………………………..
package ex1;
import [Link];
public class Ex1 {
public void Method1(){
int a=4,b=2, sum;
sum=a+b;
[Link]("sum is " + sum);
}
public void Method2(){
int a=4,b=2, sum;
sum=a*b;
[Link]("sum is " + sum);
}
public void Method3(){
int a=4,b=2, sum;
sum=a-b;
[Link]("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 [Link];
public class Optionj {
public static void main(String[] args) {
String input1=[Link]("enter first integer");
String input2=[Link]("enter second integer");
String input3=[Link]("enter third integer");
int value1=[Link](input1);
int value2=[Link](input2);
int value3=[Link](input3);
int sum=value1+value2+value3;
[Link](null,"sum is equal " + sum);