This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 14956
    
  26

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: 4541
    
    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: 43995
    
  33
And why are you using $ and _ symbols in your identifiers? That is not usually a recommended style.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: SCJP Difficulty
 
It's not a secret anymore!