Solved

Strange string constructor compile error

Posted on 2007-11-28
1
150 Views
Last Modified: 2010-03-30
Hi,

I made a class like:

    public class Whatever
    {
        public void Whatever(String str);
    }

I'm using it in some other file like:

    Whatever w = new Whatever("hello");

but the compiler is complaining that it can't find a constructor for Whatever that takes a String. Why would this be happening? I'm using other functions as part of the same / other classes that take a string as a parameter, no problem...

Thanks
0
Comment
Question by:DJ_AM_Juicebox
1 Comment
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 20371559
ctor do not have return type

    public class Whatever
    {
        public Whatever(String str)
        {
        }

    }
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 49
SHA2 certs for IIS AND Java? 2 121
Java exception bubble up 2 24
Convert from a json string array to a Java object 3 63
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question