This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Code fails to compile for Panel Object  RSS feed

 
Vishal Karnik
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
PLease help me understand why below code fails to compile at line no. 1




But when I make changes as below the code compiles properly



What is difference between (1) and (2)
 
Peter Muster
Ranch Hand
Posts: 74
5
Eclipse IDE Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I replace "JPanel panel panel = new JPanel(); ----- (1)" with "JPanel panel = new JPanel();" the code does compiile for me. It doesn't throw a runtime exception either if I add an empty public static void main method and execute it. What error does the compiler return? Do you get an error if you compile the code without the duplicate "panel"?
 
Vishal Karnik
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for help it worked fine now.
 
Campbell Ritchie
Sheriff
Posts: 55329
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
Please explain what the number Strings mean: are they some sort of constraint for the grid layout?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!