Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Machine Learning with TensorFlow
this week in the
Artificial Intelligence and Machine Learning
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Bear Bibeault
Henry Wong
Devaka Cooray
Saloon Keepers:
salvin francis
Tim Moores
Tim Holloway
Stephan van Hulst
Frits Walraven
Bartenders:
Jj Roberts
Carey Brown
Scott Selikoff
Forum:
Programmer Certification (OCPJP)
compilation error
selvas kumars
Ranch Hand
Posts: 115
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
why this code gives a compilation error??
public static void main(
String
args[]) {
int j=0;
for(j;j<6;++j)
System.out.println(j);
}
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
I like...
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I think that's because j is not used properly in the initialization clause of the for loop. There has to be some kind of assignment there or nothing...
Val
My Linked In
Jane Griscti
Ranch Hand
Posts: 3141
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi selvas,
The initialization section of the for loop has to be either nothing or a valid expression. Change your code to:
int j; for( j = 0; ... )
and it will work.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
Jane Griscti
SCJP, Co-author
Mike Meyers' Java 2 Certification Passport
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Inheritance problem
print statement in the declaration ...
I/O AGAIN
on switch expression
More...