PDA

View Full Version : Anyone Speak JAVA?


Killer Chef
02-07-02, 03:12 AM
Hi, I have just started a JAVA programming course and I'm trying to get my first assignment running. It's only a small little program but it's giving me grief. I know it's a simple little problem as I had it working earlier today just after I wrote it.
See Below

import ccj.*;
public class hellogeorge
{
public static void main (String [] args)
{
String name;
System.out.print ("Enter Your Name Please :");
name= Console.in.readLine ();
System.out.println("\n\nHello "+name);
}
}

And the error I'm getting is
cannot resolve symbol
location: package Console
name= Console.in.readLine ();

Anyone know what the problem is?? (apart from me obviously:) )

Thanks!!

XWRed1
02-07-02, 11:43 AM
Is it Console.In.Readln, maybe? Or maybe System.In.Readline? Or maybe System.In.Readln?

Slychilde
02-07-02, 04:58 PM
What's the code in ccj that you imported?

I'm learning Java for my programming and problem solving class, too! The current problem we're on, we're supposed to make a bank account that prompts the user for their info and pretty much just spits it back out all pretty like.

Anyways, do you need any throws? Maybe this would help: throws java.io.IOException.
Also, you forgot to flush your text before you prompted for input, so when it does compile successfully, it might not even show the line "Enter your name please:".

My other thought is that java is case sensitive and console shouldn't be capitalized?

Just outta curiosity, what program are you using and what book? Would be interesting to see what other schools use :)

Killer Chef
02-07-02, 08:20 PM
I managed to get it working properly, after about 4 hours of trouble shooting I realised that I didn't have a file in the right diretory...DOH!!!

The program I'm using is JCreator, and the book is JAVA, How to Program.

When it finnaly compiled it worked flawlessly aswell ..wOOt!!
the word Console does have a capital C also :)

thanks!

XWRed1
02-08-02, 06:44 PM
Aha! So I was right! It *was* your classpath. I.e., the class you wanted to import wasn't in your classpath.