Java Exercise for Learners
Tuesday, August 8, 2017
Sunday, August 6, 2017
Find the second smallest among three numbers
import java.util.*;
public class Prog{
public static void main(String... args){
Scanner in = new Scanner(System.in);
int a,b,c,d,e;
System.out.print("Enter 1st num: ");
a = in.nextInt();
System.out.print("Enter 2nd num: ");
while((b=in.nextInt())==a){
System.out.print("Duplicate.. Try again : ");
}
System.out.print("Enter 3rd num: ");
while((c=in.nextInt())==b || c ==a){
System.out.print("Duplicate.. Try again : ");
}
d = Math.min(a,b);
e = Math.max(d,c);
System.out.println(+e);
}
}
Friday, March 24, 2017
Tuesday, February 17, 2015
Random Number
Write a java program to generate random number. Also write the same to generate random number between given range.
Watch the solution
Watch the solution
Sunday, February 8, 2015
1. AWT Introduction
This is the illustration about how to use awt API in java to create GUI Based program.
This video will help the java learners to begin with using java.awt API quickly.
This video will help the java learners to begin with using java.awt API quickly.
Monday, February 2, 2015
1. Show Main Thread
1. Write a program to display the name of thread while executing the main() method.
Solution
Solution
3. Hello Name - 2
3. Write a program in java to print "Hello Name" using command line argument with taking care of possible runtime exception.
Solution
Solution
Subscribe to:
Posts (Atom)