Brand new to java

Da'iMacDaddy

Unix Newb.
OK I bought a book.... to help me learn java. I chose java because it is multiplatform (so i figured the book would be good for macs too)
and now im getting some error messages when i go to compile the code on the command line. 5 errors and all are "Cannot resolve symbol"
I was wondering is there something that I could be missing. If you would like to see my code here it comes.


/*
*HelloUser
*Demonstrates simple I/O
*/

import Java.io.*;
public class HelloUser {
public static void main(String args[]) {

String name;
BufferedReader reader;


reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("\nWhat is your name? ");
try {
name = reader.readLine();
System.out.println("Hello, " + name + "!");
}

catch (IOException ioe) {
System.out.println("I/O Exception Occurred");
}
}
}




Well thanx in advance
 
Try a simpler program first:

public class HelloWorld {

static void main(String[] args) {
System.out.println("hello world");
}

}
 
I've done the whole helloworld program already... like i said im using a book and normaly you would read a book from cover to cover and any programming book has the helloworld app in it :D thanx though and i'll try the capitol j thing i could have sworn i checked it but those things happen you know?
 
Have you done any programming before? If not I'd recommend signing up for a summerschool course at your local Uni.

I did a intro to Java course last year. I thought it'd be pretty easy (and it was, I did have a bit of experience though) but I learned heaps that would have really stumped me if I hadn't done it.

For example if you do:
if ("fred" == "fred") {

}
it will turn out false every time. This is because Strings in Java are objects, and the test for equality (==) tests if it is the same object, not just an object with the same value.

There's quite a few little things like that which aren't necessarily obvious...

But if your book is good then you should be told most of the traps like that.

Oh yeah, and I'd also recommend jEdit as your text editor/ide. It's all written in Java, and has heaps of nice features and syntax hilighting and everything. http://www.jedit.org
 
freaking wrappers...

I'm working with j2ee now and it won't let you use primitives for alot of things because of databases, so I've gotta use java.lang.Integer and java.lang.Boolean, etc.

Freaking wrappers. I miss operator overloading!

Sorry I just needed to vent that it seemed to fit in with this thread :)
 
Originally posted by skrillerd
freaking wrappers...

I'm working with j2ee now and it won't let you use primitives for alot of things because of databases, so I've gotta use java.lang.Integer and java.lang.Boolean, etc.

Freaking wrappers. I miss operator overloading!

Sorry I just needed to vent that it seemed to fit in with this thread :)


Wrappers are necessary to advantage of the OO features of Java. True OOP languages have no primitives only objects. Java's wrappers are a substitute to that!

And yes operator overload is a cool missing feature
but it does make a lot a programs complicated, thats why Java does not have it
 
Back
Top