• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic