0% found this document useful (0 votes)
10 views3 pages

Method Calling in Diffrent PCKG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Method Calling in Diffrent PCKG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1)

package methodCalling1;

public class A {

public void welcome() {


System.out.println("Welcome to BikkadIT");
}

package methodCalling2;

import methodCalling1.A;

public class B {

public void greet() {


System.out.println("Good Evening All");
}

public static void main(String[] args) {

B b = new B();
b.greet();

A a = new A();
a.welcome();
}
}

2)

package methodCalling2;

public class B {

public void greet() {


System.out.println("Good Evening All");
}

package methodCalling1;

import methodCalling2.B;

public class A {

public void welcome() {


System.out.println("Welcome to BikkadIT");
}
public static void main(String[] args) {

A a=new A();
a.welcome();

B b=new B();
b.greet();

3)

package methodCalling2;

public class B {

public static void greet() {


System.out.println("Good Evening All");
}

package methodCalling1;

import methodCalling2.B;

public class A {

public static void welcome() {


System.out.println("Welcome to BikkadIT");
}

public static void main(String[] args) {

A.welcome();

B.greet();

4)

package methodCalling1;

public class A {
public static void welcome() {
System.out.println("Welcome to BikkadIT");
}

package methodCalling2;

import methodCalling1.A;

public class B {

public static void greet() {


System.out.println("Good Evening All");
}

public static void main(String[] args) {

A.welcome();

B.greet();

}
}

You might also like