This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

urgent: please help: importing variables interdependent classes

 
Abhi Chat
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Report post to moderator
Im tryin to use a variable of class x in class y, and vice versa. they are in the same package. Now the problem is i cacnot compile claas x as it says variable not found and niether class y as it gives the same error.

My problem is : i have 2 class x which is the GUI and classs Y which does the prser of the file and gives result. Class Y needs the name of the file which the user accepts through JFIleChooser, and does the work. Now class X calls the method of class y to get results. Now i cant compile class y as it needs the variable from class X and neither can class X as it needs the method from class Y.

Please advice
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Report post to moderator
Sounds like this oughtta work. (Whether it's a good design or not is for another day.) There are all kinds of "circular references" in common code. Can you include some code and some error messages? Code fragments --- just where things are declared and referenced --- are probably enough. Are you using an IDE or compiling from the command line?
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Report post to moderator
This thread was also posted in "Java in General (advanced)". Please don't cross-post.

You got more answers over there. Maybe because you didn't put "urgent" in the subject. Please don't.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same thread in multiple forums. It makes a conversation difficult to follow, and wastes peoples time when they answer a question that's already been answered elsewhere.

Please continue teh conversation here.
 
    Bookmark Topic Watch Topic
  • New Topic