The Artima Developer Community
Sponsored Link

Java Answers Forum
compiler error. cannot resolve symbol constructor Ex4_10(int)

2 replies on 1 page. Most recent reply: Apr 17, 2003 6:54 PM by Jack

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Jack

Posts: 6
Nickname: daxian2003
Registered: Apr, 2003

compiler error. cannot resolve symbol constructor Ex4_10(int) Posted: Apr 14, 2003 12:57 AM
Reply to this message Reply
Advertisement
//Why compiler error. cannot resolve symbol constructor
//Ex4_10(int)???
//

public class Ex4_10
{

public Ex4_10()
{
this(10); //compiler error. cannot resolve symbol constructor Ex4_10(int)
}
public void Ex4_10(int x)
{
System.out.println("Your number: " + x);
}
public static void main(String args[])
{
new Ex4_10();
}
}


Singh M.

Posts: 154
Nickname: ms
Registered: Mar, 2002

Re: compiler error. cannot resolve symbol constructor Ex4_10(int) Posted: Apr 14, 2003 2:35 AM
Reply to this message Reply
> //Why compiler error. cannot resolve symbol constructor
> //Ex4_10(int)???
> //
>
> public class Ex4_10
> {
>
> public Ex4_10()
> {
> this(10); //compiler error. cannot resolve symbol
> l constructor Ex4_10(int)
> }
> public void Ex4_10(int x)
> {
> System.out.println("Your number: " + x);
> }
> public static void main(String args[])
> {
> new Ex4_10();
> }
> }

 public void Ex4_10(int x)


that is because of the keyword void you have placed before the name. Constructors do not have return types.

Jack

Posts: 6
Nickname: daxian2003
Registered: Apr, 2003

Re: compiler error. cannot resolve symbol constructor Ex4_10(int) Posted: Apr 17, 2003 6:54 PM
Reply to this message Reply
Thank you very much.

Flat View: This topic has 2 replies on 1 page
Topic: read file puzzled Previous Topic   Next Topic Topic: Class Instances

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use