Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System or system?

 
hamza mohamed ansari
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still i,m having the same error package system does not exist ,even i changed System instead of system/.
error ^ is pointing out the( . )dot




my code
public class loopy
{
public static void main(string[] args)
{
int x=1;
System.out.println("before the loop");
while(x<4)
{
System.out.println("in the loop");
x=x+1;
}
System.out.println("this is after loop");
}
}
 
Campbell Ritchie
Sheriff
Pie
Posts: 49460
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please do not add new questions to an old thread. Fortunately I can create a new thread from your post.
Please copy‑and‑paste all code and errors. I ran your code and did not get the error you quoted. You did however manage to write string instead of String.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15369
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is case-sensitive. That means that "System" is not the same as "system", and "String" is not the same as "string". You have to get the spelling exactly right; if the name of a class has a capital letter, then you must write it exactly like that.
You write:

Class String is with a capital S. So that should be:
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's also easier to get used to the conventions if you use them yourself. Following standard Java conventions classes always start with a capital (like String and System), and variables and methods with a lower-case letter. So while it makes no difference to whether it works or not, Loopy is a better class name than loopy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic