Results 1 to 12 of 12
Thread: java problem
- 07-19-2012, 09:57 AM #1
Member
- Join Date
- Jul 2012
- Posts
- 12
- Rep Power
- 0
java problem
SOLVED REQUESTING LOCK
hi, im zunon im 13 yrs old and im learning java, while reading the book :
Java: a beginners guide fifth edition i stumbled upon the same error twice:
when I copy the code shown in the book and try to compile them I get an error in javac but when I copy and paste the exact same code from the file from the website it compiles and runs perfectly, I tried to spot and eliminate every difference I find in the 2 texts can you help me and find the differences I couldn't find?
My version of the code:
the supplied one from the book:Java Code:/* This program illustrates the differences between int and double. Call this file Example3.java */ class Example3 { public static void main(String args[]) { int var; // this declares an int variable double x; // this declares a floating-point variable var = 10; // assign var the value 10 x = 10.0; // assign x the value 10.0 System.out.printIn("Original value of var: " + var); System.out.printIn("Original value of x: " + x); System.out.printIn(); // print a blank line // now, divide both by 4 var = var / 4; x = x / 4; System.out.printIn("var after division: " + var); System.out.printIn("x after division: " + x); } }
Java Code:/* This program illustrates the differences between int and double. Call this file Example3.java. */ class Example3 { public static void main(String args[]) { int var; // this declares an int variable double x; // this declares a floating-point variable var = 10; // assign var the value 10 x = 10.0; // assign x the value 10.0 System.out.println("Original value of var: " + var); System.out.println("Original value of x: " + x); System.out.println(); // print a blank line // now, divide both by 4 var = var / 4; x = x / 4; System.out.println("var after division: " + var); System.out.println("x after division: " + x); } }Last edited by Zunon; 07-19-2012 at 11:13 AM. Reason: add code tags
- 07-19-2012, 10:06 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Re: java problem
What did your compiler complain about? (copy the error message verbatim here please).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-19-2012, 10:10 AM #3
Member
- Join Date
- Jul 2012
- Posts
- 12
- Rep Power
- 0
Re: java problem
Example3.java:16: error: cannot find symbol
System.out.printIn("Original value of var: " + var);
^
symbol: method printIn(String)
location: variable out of type PrintStream
Example3.java:17: error: cannot find symbol
System.out.printIn("Original value of x: " + x);
^
symbol: method printIn(String)
location: variable out of type PrintStream
Example3.java:19: error: cannot find symbol
System.out.printIn(); // print a blank line
^
symbol: method printIn()
location: variable out of type PrintStream
Example3.java:25: error: cannot find symbol
System.out.printIn("var after division: " + var);
^
symbol: method printIn(String)
location: variable out of type PrintStream
Example3.java:26: error: cannot find symbol
System.out.printIn("x after division: " + x);
^
symbol: method printIn(String)
location: variable out of type PrintStream
5 errors
- 07-19-2012, 10:11 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Re: java problem
And please use [code] tags [/code] when posting code.
Please do not ask for code as refusal often offends.
- 07-19-2012, 10:12 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Re: java problem
That's a lower case 'L' in println, not an 'I'.
Please do not ask for code as refusal often offends.
- 07-19-2012, 10:17 AM #6
Member
- Join Date
- Jul 2012
- Posts
- 12
- Rep Power
- 0
Re: java problem
no I'm pretty sure that's an I using np++ I can see the difference between I and l
- 07-19-2012, 10:24 AM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Re: java problem
Turn on the light above your computer screen and check again.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-19-2012, 10:33 AM #8
Member
- Join Date
- Jul 2012
- Posts
- 12
- Rep Power
- 0
- 07-19-2012, 10:52 AM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
- 07-19-2012, 11:10 AM #10
Member
- Join Date
- Jul 2012
- Posts
- 12
- Rep Power
- 0
- 07-19-2012, 11:12 AM #11
Member
- Join Date
- Jul 2012
- Posts
- 12
- Rep Power
- 0
Re: java problem
I just downloaded Eclipse and I see that PrintIn is wrong but Println in right... but what does the Ln part mean? Requesting lock for thread
- 07-19-2012, 11:22 AM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Similar Threads
-
Java GUI problem
By Rezan in forum AWT / SwingReplies: 0Last Post: 04-08-2012, 11:23 PM -
Problem with Java Web Applications and Java in Control Panel
By Abysinian in forum Advanced JavaReplies: 4Last Post: 03-16-2012, 11:29 AM -
Small problem with problem with Java, C++ parse program.
By dragstang86 in forum New To JavaReplies: 4Last Post: 10-30-2011, 03:43 AM -
Problem Display Jmenubar Java Se6 u23 versus Java SE6 u22
By Ravanelly in forum Advanced JavaReplies: 0Last Post: 01-07-2011, 09:36 AM -
Java Problem. Need Help!
By bob101 in forum New To JavaReplies: 6Last Post: 03-19-2009, 04:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
... I thought it should be with an I not an L, I didn't know that ... Sorry for arguing, I'm too stupid to have seen that..gif)

Bookmarks