# Very noobi question in Java



## Flash (Apr 20, 2011)

So, I'm doing some sample exercises, and I have no idea why there is a compiler error on line 6

public class Awake {
	public void Awake(String time){
		System.out.println(“Time is “+time);
	}
	public static void main(String[] args){
		Awake a = new Awake(“up!”); //ERROR HERE
	}
}

Please enlighten me.
Thanks


----------



## Kreij (Apr 20, 2011)

What's the compiler error?


----------



## Flash (Apr 20, 2011)

Cannot find symbol, constructor Awake.


----------



## Kreij (Apr 20, 2011)

I'm not a Java expert but try removing the "void" in the constructor.

public class Awake
{
public Awake(string time)
{
...
}
}

Make sure you have everything included to handle the System.out.println call too.
I could be wrong. :/

I really need to brush up on my Java.


----------



## Flash (Apr 20, 2011)

Wow, don't I suck.

Yep, void is a return type, and making it void transforms the constructor into an ordinary method.

Thanks. Should've noticed that.


----------



## Kreij (Apr 20, 2011)

You don't suck, Flash. Overlooking things like that happen all the time.
I haven't programmed in Java in years and was just going by my C# experience. DOH !!
I guess for me, even a blind squirrel finds a nut once in awhile.


----------



## 3870x2 (Apr 20, 2011)

Kreij said:


> You don't suck, Flash. Overlooking things like that happen all the time.
> I haven't programmed in Java in years and was just going by my C# experience. DOH !!
> I guess for me, even a blind squirrel finds a nut once in awhile.



Kreij makes everyone feel like they suck, he solved a problem in a language that he didn't even know 

Legend has it that Kreij developed the C language.

Historians maintain that the project was stolen from him.


----------



## Kreij (Apr 20, 2011)

Thanks for the laugh, 3870, but there are a lot of great coders here on TPU who make me look stupid in the languages I've not used in quite some time (like C++ and Java).

We all just try to help where we can. 

BTW ... I was going to name it "K" before Dennis Ritchie stole the code and named it "C".


----------

