How can we access some class in another class in java?



How can we access some class in another class in java?..

Answer / Simpy Kumari

To access a class from another class, you should ensure that both classes are in the same package or use the fully-qualified name of the class. If necessary, import the class at the beginning of your Java source file to avoid typing the full name.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?

1 Answers   Bravura Solutions,


Can keyword be used as identifier?

1 Answers  


take any 4 input numbers. like 2345.. wanted out put is All 16 combinations of the number 2345.. for example- taking input as 4565 output- 5654 4556 4655..

2 Answers   Emphasis,


Why is java called the platform independent programming language?

1 Answers  


What is the use of set in java?

1 Answers  


How do you use, call, and access a non-static method in Java?

2 Answers  


What makes a function well defined?

1 Answers  


The following program is Overloading or Overriding? public class PolymorphismEx { public int sampleMethod(int a) { return a; } public String sampleMethod(int a) { return "Is it Overloading or Overriding???"; } }

4 Answers   Ness Technologies, TCS,


What is the purpose of the finalize() method?

1 Answers  


Tell me how many ways are there to initialise an integer with a constant.

1 Answers   Aricent,


What are interfaces?

3 Answers  


Is it possible to compare various strings with the help of == operator?

1 Answers  


Categories