Solved

Strange string constructor compile error

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 40
arguments to jar 5 26
CSV file parsing thru Java 13 26
Problem to Alipay 10 18
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

813 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

9 Experts available now in Live!

Get 1:1 Help Now