• 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

Using the Dog Class and Its Methods

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there .. i've a question -




i am getting an error when i run this program --

C:\xxx\xx\xxx>javac c:\workspaces\Dog\Dog*.java
c:\xxx\xxx\Dog.java:5: error: cannot find symbol
string name;
^
symbol: class string
location: class Dog
c:\workspaces\Dog\Dog.java:6: error: cannot find symbol
string breed;

------------

if i hide // string name ; and other variables , it runs fine --
C:\xxx\Dog>java DogDemo
Age6
----------------

any ideas on whats going on ?!!
 
Ranch Hand
Posts: 679
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is case sensitive. There is no string class in ths standard API.
 
Abid Ramay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stuart A. Burkett wrote:Java is case sensitive. There is no string class in ths standard API.



thanks for your help .. now i've different error ..

c:\workspaces\Dog\DogDemo.java:9: error: cannot find symbol
Dog d1 = new Dog();
^
symbol: class Dog
location: class DogDemo
c:\workspaces\Dog\DogDemo.java:9: error: cannot find symbol
Dog d1 = new Dog();
^
symbol: class Dog
location: class DogDemo
c:\workspaces\Dog\DogDemo.java:11: error: cannot find symbol
d1.name = denver;
^


 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java is case sensitive.
try using String(with capital S).
String is pre-defined class in java.
and also use " " while initializing a string like
String name = "john";
 
Abid Ramay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vicky garg wrote:java is case sensitive.
try using String(with capital S).
String is pre-defined class in java.
and also use " " while initializing a string like
String name = "john";



hi there .. i am still getting one error where it intially started.

c:\workspaces\Dog\DogDemo.java:9: error: cannot find symbol
Dog d1 = new Dog();
^
symbol: class Dog
location: class DogDemo
c:\workspaces\Dog\DogDemo.java:9: error: cannot find symbol
Dog d1 = new Dog();
^
symbol: class Dog
location: class DogDemo
2 errors
 
Abid Ramay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there

thanks for your help .. got it now ..

C:\Workspaces\Dog>java DogDemo
Namedenver
Age6
breedsheperd
 
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic