Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package myinfo;
- class myinfoo{
- int lenght;
- int age;
- myinfoo(int lenght,int age)
- {
- this.lenght=lenght;
- this.age =age;
- }
- myinfoo(int info)
- {
- this(info,info);
- }
- myinfoo()
- {
- this(180,50) ;
- }
- void set_age(int age)
- {
- this.age=age;
- }
- void set_lenght(int lenght)
- {
- this.lenght=lenght;
- }
- void print_myinfo()
- {
- System.out.println(lenght);
- System.out.println(age);
- }
- }
- public class Myinfo {
- public static void main(String[] args) {
- myinfoo info1 = new myinfoo(170,23);
- info1.print_myinfo();
- System.out.println("\n");
- myinfoo info2 = new myinfoo(170);
- info2.print_myinfo();
- System.out.println("\n");
- myinfoo info3 = new myinfoo();
- info3.print_myinfo();
- }
- }
Advertisement
RAW Paste Data
Copied
Advertisement