i am very beginner to java getting error in below code

class forloop{
public static void main(string args[]){
int x;

for(x=0;x<10;x=x+1)
system.out.println("this is x:"+x);
}
}

error : cannot read :forloop.java
i error

please help me

Recommended Answers

All 3 Replies

Is this the exact code that you use?
Because string needs capital S and system, needs capital S:

class forloop {
  public static void main(String args[]){
   int x;

   for(x=0;x<10;x=x+1)
    System.out.println("this is x:"+x);
   }
}

How do you compile the .java file?

Also for future references, you should name your .java files with capital letter:
ForLoop.java

class ForLoop {

}

It is common practice.

Java is case-sensitive. There's a difference between "string" and String, and between "system" and "System". Capitalize those two words and you should be okay.

Java style suggests that class names be in the form MyClassName (first letter of each word in caps) and variable/method names in the form myMethodName (initial lowercase, internal capitalization). It's good to stick with that form, it makes your code easier to read. Especially useful if you're asking other to help you solve problems in your code.

got it thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.