aspose file tools*
The moose likes Beginning Java and the fly likes SCJP Difficulty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SCJP Difficulty" Watch "SCJP Difficulty" New topic
Author

SCJP Difficulty

Shreyansh Singh
Greenhorn

Joined: Jun 22, 2011
Posts: 2

While running the following Program on NetBeans ,I am getting the following Error:

D:\JAVA\Java$Program\src\java$program\SCJP_Richard_Raposa_Pg_189_Buffalo.java:31: cannot find symbol
symbol : constructor SCJP_Richard_Raposa_Pg_189_Buffalo(boolean)
location: class java$program.SCJP_Richard_Raposa_Pg_189_Buffalo
SCJP_Richard_Raposa_Pg_189_Buffalo b=new SCJP_Richard_Raposa_Pg_189_Buffalo(false);
1 error
BUILD FAILED (total time: 0 seconds)


Actual Program:-




Please somebody help me to rectify my mistake and if possible please explain my mistake...
Thank You in advance.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14350
    
  22

Welcome to the Ranch.

The error message says that the compiler cannot find a constructor for the class SCJP_Richard_Raposa_Pg_189_Buffalo that takes a boolean as an argument.

Looking at your source code, your class SCJP_Richard_Raposa_Pg_189_Buffalo indeed does not have such a constructor. So, you'll have to add it.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4467
    
    8

That error message tells you that you're trying to use the constructor SCJP_Richard_Raposa_Pg_189_Buffalo(boolean) - on line 28 of the code above. But that class doesn't have a constructor that takes a boolean. Since you haven't defined a constructor the compiler will insert one, but it will insert one that takes no arguments.

So you either needs to change it to:or you need to add the missing constructor.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39869
    
  28
And why are you using $ and _ symbols in your identifiers? That is not usually a recommended style.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SCJP Difficulty