//https://csprograms4u.blogspot.com/
//Chapter 3
//Program 1
//use of class in Java
import
java.util.Scanner;
class
distance
{
int x;
double y;
}
public
class Simple_Class
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
distance d1=new distance();
distance d2=new distance();
System.out.println("Enter two
integer values");
d1.x=sc.nextInt();
d2.x=sc.nextInt();
System.out.println("First Integer
value="+d1.x);
System.out.println("Second Integer
value="+d2.x);
System.out.println("Enter two
decimal values");
d1.y=sc.nextDouble();
d2.y=sc.nextDouble();
System.out.println("First float
value="+d1.y);
System.out.println("Second float
value="+d2.y);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.