how to access methods from another class in java

class A { 
  
    public void a1 ( ) { 
    } 
 
    private void a2 ( ) { 
    } 
} 
 
class B { 
 
    private A objA = new A ( ); 
 
    public void b1 ( ) { 
        // Call to method a1. This works. 
        objA.a1 (); 
    } 
 
    void b2 ( ) { 
        // Call to method a2. This will give compile error. 
        objA.a2 (); 
    } 
} 

4
1

                                    public class Alpha extends Beta{
     public void DoSomethingAlpha() {
          DoSomethingBeta();  //?
     }
}

4 (1 Votes)
0
4.43
7

                                    public class Alpha {
     public void DoSomethingAlpha() {
          Beta cbeta = new Beta();
          cbeta.DoSomethingBeta();  //?
     }
}

4.43 (7 Votes)
0
4.11
9
Charel-f 110 points

                                    Beta.DoSomethingBeta();

4.11 (9 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
java using other classes how to call a class in java from another class how to call another class method in java java how to use other classes methods How to use a method from another class in Java how to access another java class in java use class method in another class java can you call a method from another class in java calling another method in the same class java how to use class method in another method java how to access methods in a class java how to reference a method in a class from another class java how to reference a method from another class java accessing methods from another class java thout new how to create a method of another class in main class java java how to call another class how to use method from different class java java access function from another class access a class instance from another function java java run a method from another class using method object java run a method from another class java call class with in class with in another class calling another class in java class calling another class java java how to access object from another class access class from another porject java how to use other class in java call a class to another class in java access function from within class java call the methode of a class in another class java use a function from another class java use a function another class java use a functions another class java java call one method from another class accessing another class in class method How to use method from another Java class? how to call methods from another class in java How do I use method from another Java class? how to call an object in another class java How to access a function in a class within a class java hohow to call an object in another class in java call a different class object java calling method of another class in java how to call a method from a different class java how to call a method from another method of same class in java call a method of another class in java use methods from other classes java how to put functions in one class and call them from other class java calling a class in another class java how to access a variable from another method of another class in java using class in another class java how to call a java class from another class call other class java how to access a class from another class in java call class through another class method java java class call another class how to call the method from another class in java if we 3 class how to call the method from another class in java java how to call a class from another class java call object from another class java call class from another class accessing methods from another class java access methods from another class java access method from another class java java using method from other class java how to use method from another class java method that reads another class call method of another class using import class java access method in another class java java run method from another class how to access a method from another class access to a method from another class call a method in a different class java call a method from another class jva call java class in another class call java class from another class how to call method in different class java how to set a method to another method from a class in java how to use a function from another class in java access a method from another class java java using methods from other class how to use methods in another class java java calling function in another class use method from other class java call a class from another class java accessing methods in other class java how to use other classes method in java call method in main java from another class java how to call a method from another class java java accessing a class from another class java call method another class can we define a class within method in java how can a class take method from another class in java use another method from another class java java how to see method from another class can we call a method from a class in an another class in java how to call method from another class in java call a methof from a differnet class java java call method from another class file how to access public methods from another class java accessing class members from another class in java is called use a class in the definition of another class in java use class from another java java is it possible to use a method of another class call method in java from another class call method of another class from another class in java invoke a method from another class java reflection invoke a method from another class java java call a method from a different class how to create methods in java in another classe how to create methods in java in another classes Java use funcs from other class java a class using another class method java how to call methods from other classes how to use method just when another method of another class called how to get a method from another class in java how to use a class method in another method in java how to use a class method in another method how to use a class method in another class java how to call another class in java how to implement another class in java java call another class using another class in java how to call object of another method and class java java using methods from another class java call another class method HOW TO CALL OTHER CLASS IN JAVA how to use another class method java how to access class methods in java using a method from another class java calling a class from another class java how to use another java class javainherit methods from another class calling a method java from another class java how to get a function from another class java make class implement and use methods in another class How to call a function from another class java how to access a functions of another class in java how to access methods from other classes in java hpow to call a method from another class java how to refer to a method in another class java use function of another class java use function of other class java Java how call from a different class how to implement a class into another in java creating an method of class in another class java how to call a function from another class in java java class uses another class how to get method for another class java use a class in another class java how to call method from one class to another in java how to use methods from other classes in java use methods in main java from other classes java acces a method from another class how to call a method from another class file in java using methods from another class java access function from different class java use method of one class in another in java how call am method from another class java how to call for different methods in different classes in java calling methods from other classes java java calling methods from another class cant call a method from another class java calling another class from another class java calling another method from another class java get method from another class java java use method of another class java use class in another class how to call method in another class java java call method from another class example java how to use methods from another class how to call a method in different class java how to call a method from another class in java using methods of another class java java use another class calling a method from a method in another class java java how to call method from another class calling another class method java How to access the method of class in Java java access a method in another class java reference methods from another class java use method from another class how to access class from another class in java how to access method from another class in java calling methods in java from another class how to reference methods in other classes in java? call a class in another class java java call class method from another class Java calling another class can we use one class method in another class in java java example use method in another class how to call method from another java class use a method from another class java in an instance how to create a method inside a class in java java define a method inside a class can i call method from of another class in java can java use functions from another class? calling methods from another class java accessing methods from other classes java java how to access methods from another class how to use another class method in java use methods from another class java calling a method from another class java java calling a method from another class how to call a method from one class to another class in java java use methods from other classes use class in another class java include another method inside a class java write another method inside a class java create a method that uses information from another class java how to call a method in another class java what do you call a class in another class java calling method of one class from another java how to call one method from another method in same class in java how to call other methods from other class in java how to call a class in another class java java how to call a method from another class how to access a class in another class java call method from another class java java how to start a method in another class how to use another class in java how to call a class from another class in java call method of another class in java access public method of another class java access the method of another class jav can a class use a method in another method how to get methods from other classes in java java use method in another method best way to access a method in another class java how to use an object from another class java how to call method from another class java how to call a class in another class in java how get function results in another class java how to access a method from another class in a another package java how to call a method from one class to another in java how to call methods to other classes in java call a method from another class java how ot access another class in java how to call method of another class in java java return value to another class java call method from another class java find methods in other classes java access method from another class java method to access other class using method from another class java class inside class in java how to gain access to other classes in java how to use other classes in java get access to another class method in java how to get other classes in java using method in java in another class using a method of another class in java how to call a class inside another class in java how to access variable from another class in java how to call class in another class in java use methods in another class java implement java class inside another how to call a method from another class java how to activate oher classes in java how to call a class in java how to access methods from another class in java use method of another class java how to call a method in java from another class how to use method from other class how to access method in another class java how to use method from another class java how to use a class in another class java how to call a java method from another class why cant i reach a method in another class injava how to access a method in another class java how to use methods from another class in java how to use a java class in another java class run public method from another class java how to access a public function java use a method from another class java java using a method from another class how to reference methods from other class in java how to access a method from another class java call functiioon from naother class java how to call a method that is in class created from another class how to get method from another class java how to access method of another class in java how to access methods of another class in java how to use a public method in another class java how to use a method in another class java access methods of another class java call public method from another class java how to access another class in java how to use methods from a different public class in java how to use methods from a different class in java how to call a public method from another class in java java how to use a method from another class how to use a method from another class how to call methods from other classes in java java use function from another class java make a method to use in another class calling a function in a seprate class how to use a method from another class java use other class methods get a function from another class java Get function from another class java\ use method from another class java
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source