This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hello i m new in this forum.I m trying to type some Java examples on Eclipse but i have many errors.When i copy paste the same example onn Eclipse i get no errors and the program runs normal.
We need more details from you. Assuming you are typing and pasting the same examples, and the typed ones don't work, then that would mean you are making some typing errors. If you show us the program, and the errors you are getting, we can help point you in the right direction.
Yes, it is a pain, but eventually you start learning things like "String" is not the same as "string". It really does teach you to be more careful when you code.
When you do get errors, the best thing to do is to fix the first one, and then recompile. A lot of errors mask others, or make the compiler think there are more than there really are. So, fix the first one, and see what's left.
Never ascribe to malice that which can be adequately explained by stupidity.
apostolos kikirikou
Greenhorn
Joined: Jan 12, 2013
Posts: 4
posted
0
I have typed an example with differences in days between 2 days.I get errors on Print in stream methods.The method is undefined for the method print Stream.
If i delete my typed statements and paste those from the example 's source code the errors disappear .Or i have to folllow Eclipse to rename to PrintIn.
apostolos kikirikou wrote:I have typed an example with differences in days between 2 days.I get errors on Print in stream methods.The method is undefined for the method print Stream.
If i delete my typed statements and paste those from the example 's source code the errors disappear .Or i have to folllow Eclipse to rename to PrintIn.
There is no such method as PrintIn. You can look at the javaAPI to see what methods do and don't exist.
If you are trying to print some text to the screen, you should use
System.out.println()
Note: the LOWERCASE 'p'. also, it is a LOWERCASE 'l' (the letter between k and m), not an uppercase "I". It stands for something line "print with a new line".
This is a textbook case of why you should compile more often. Personally, I would have compiled after writing the first print statement. If it worked, great, I'd then add the next one. If it didn't, I'd fix it, only having to worry about ONE error. Then I'd use what I learned, and not make the same mistake on the next statement.
yes, it can be a slow, painful process. I can't tell you how many times I made the semi-colon-on-my-for-line-mistake:
This will not print ten lines, but one. The error is subtle, and I made it over and over. But once I REALLY learned it, I never made it again.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
4
posted
0
It would have been better to declare the loop variable (x) after the keyword for. Then it would have gone out of scope before the println call and your code would not have compiled. You might still have taken ages to find the wayward ; however.
apostolos kikirikou
Greenhorn
Joined: Jan 12, 2013
Posts: 4
posted
0
Thanks for your help i just now started to learn Java and i needed some help.