Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Brackets problem  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im having a serious problems with my brackets (At least i think thats how you spell them.) They were perfectaly fine untill i tried to initiate lives. After that the code has all but fallen apart. I have always had a problem with brackets so if anyone could help that would be awesome. Here is the code.


Im sorry if its a bother but i need some help.
 
Kacey Simeon
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im sure someone would like to know how i fixed it. on line 380 i had to tab over that bracket, then i had to put a bracket inbetween line 379 and line 380. then i had to delete the last braket in the code. I feel stupid but whatever.
 
Marshal
Posts: 64483
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely the answer to no 20 is "he writes down, 'Can I have some sunglasses, please.'"?
I had to divide that question because lines that long make the code difficult to read. Also deleted some blank lines. So your 360 might now be 361.
But it is a disaster to have a method that long. You should have a Quiz object, and read the questions and potential answers from a text file or files.
Never say == true or similar. Not if (crowd == true) ... but if (crowd) ... If you want it false, use if (!boo) rather than if (boo == false). The reason is that == true or similar is poor style and you can get lots of errors if you mistakenly write = instead of ==.
For reasons given here, never use the tab character when writing code. (You can use \t in Strings however).
Your printouts for randomFor5050 should be put into an array, then you can say System.out.println(answersFor5050(randomFor5050));
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!