• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

same errors (cannot find symbol) for two codes

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the same error for both these codes(both different). I been trying to figure out the problem and tried other possibilities but I just can't seem to crack it. Can someone lend me a hand and point me to the right direction.

Code 1:

Code 2:

Btw, code 2 isn't complete yet but I just wanted to compile the code I had to see if I encountered any errors so far which obviously I am.
[ September 12, 2007: Message edited by: Joey Chen ]
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You want to compile and run against which version ? anyway, here are a couple of fixes that you probably want to make.



[ September 12, 2007: Message edited by: Srikanth Basavaraju ]
 
Joey Chen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah. I see my mistakes now. Thank you, I definitely will remember these mistakes.

However, if I wanted to still use isEmpty() in the first code, how could I have used it correctly without the code getting complicated.

Also, is the length method in args.length from the java.lang.String? I am asking because I see a length() method in there but it has parenthesis after the length() so why wouldn't it be args.length()?
[ September 12, 2007: Message edited by: Joey Chen ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Joey Chen:
...is the length method in args.length from the java.lang.String? I am asking because I see a length() method in there but it has parenthesis after the length() so why wouldn't it be args.length()? ...


The variable "args" is an array (not a String), and "length" is a public field in an array.

This is described under JLS 10.7 Arrays.
 
I brought this back from the farm where they grow the tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic