# Brand new to java



## Da'iMacDaddy (Jul 9, 2002)

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


----------



## aishafenton (Jul 9, 2002)

>> import Java.io.*; 

shouldn't have a capital "J". Try


import java.io.*;


----------



## tie (Jul 10, 2002)

Try a simpler program first:

public class HelloWorld {

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

}


----------



## Da'iMacDaddy (Jul 10, 2002)

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  thanx though and i'll try the capitol j thing i could have sworn i checked it but those things happen you know?


----------



## scaryfish (Jul 19, 2002)

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


----------



## wiz (Jul 25, 2002)

yea use 

if ("fred".equals("fred")) { 

}


that would work correctly as expected


----------



## skrillerd (Jul 26, 2002)

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


----------



## wiz (Jul 28, 2002)

> _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.
> ...




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


----------



## r4bid (Jul 28, 2002)

for a great java site with a nice set of forums that are java related  check out http://www.javaranch.com 
The people there are friendly and have always been able to solve my problems.


----------

