Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I call create() method in Calculation class from Main class where the create() function belongs to Summary class ?

What I have tried:

Calculation
public class Calculation{
     private Summary create(){}
}
Main
Calculation c = new Calculation();
c.create(); // cannot find symbol
Posted
Updated 12-Jan-18 9:29am

Your method is marked as private hence it will not be accessible from outside that class, change it to public or read this for other modifiers : Access modifiers in java - Javatpoint[^]
 
Share this answer
 
Comments
wseng 9-Dec-17 10:50am    
thanks you
You need to have your class as public instead of private. Private makes it to where it cannot be accessed outside of itself, which would make it impossible to call on.
 
Share this answer
 
Comments
wseng 14-Jan-18 12:05pm    
Thanks man.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900