Professional Documents
Culture Documents
1.
abstract class shape
{
double radius;
int length, breadth;
float base, height;
abstract void area();
void input()
{
this.radius = 10.0d;
this.length = 10;
this.breadth = 10;
this.base = 4.0f;
this.height = 5.0f;
}
}
1.Output
2.
import java.util.*;
class bank
{
final int personalLoan = 1500000, educationLoan = 1000000,
homeLoan = 2000000;
final void educationLoan()
{
System.out.println("Education loan amount is:
"+educationLoan);
}
final void personalLoan()
{
System.out.println("personal loan amount is:
"+personalLoan);
}
final void homeLoan()
{
System.out.println("Home loan amount is: "+homeLoan);
}
}
public class two
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
bank b = new bank();
if(age<=25)
{
System.out.println("You are eligible for education loan");
b.educationLoan();
}
else if(age>25 && age<=45)
{
System.out.println("You are eligible for personal loan");
b.personalLoan();
}
else if(age>45 && age<=60)
{
System.out.println("You are eligible for home loan");
b.homeLoan();
}
else
{
System.out.println("Invalid age");
}
}
}
2.Output
3.
Package1:
package palindrome;
4.
import java.util.Random;
4.Output