• Post Reply Bookmark Topic Watch Topic
  • New Topic

what's up with the call  RSS feed

 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


above code is compiled fine.
now from LottoClient class i want to make a call to setGui() of above class. But when i am compiling LottoCLient class using javac -d abc LottoClient.java getting error at compile time "cannot find symbol : setGui()" in line 12



couldn't figure out why is that happening.

 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the default visibility?

hint: private or public ?

Look it up.

WP
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LottoClient class is not in the same package as GuiClient class that's why you can't see setGui() method, which has a default access modifier.

If you want to expose setGui() method to all classes mark it as public otherwise put LottoClient in package abc.

The follow is the link you need to understand the access modifiers

http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry. the LottoClient.java is in package abc



 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put LottoClient in package abc you shouldn't get any error.

I tried that and it compiles.

Did you put source files LottoClient.java and GuiClient.java in the same folder named abc?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!