• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using the Dog Class and Its Methods

 
Abid Ramay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • 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 ?!!
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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;
^


 
vicky garg
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
hi there

thanks for your help .. got it now ..

C:\Workspaces\Dog>java DogDemo
Namedenver
Age6
breedsheperd
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic