Solved

Strange string constructor compile error

Posted on 2007-11-28
1
146 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now