Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Get Length of Array 
 

In this Tutorial we want to describe you a code that help you in understanding the java error message. For this we have a class name java error message.

 

Get Length of Array

                         

In this Tutorial we want to describe you a code that help you in understanding the java error message. For this we have a class name java error message. Inside the class we have a main method that consists of-

1)InputStreamReader-The input stream reader is used to read the byte code that is used to encode the byte code into character stream.

2)Buffered  Reader   - The Buffered reader is used to read a text from a character input Stream reader.

3)readline                 -The readline is used to read a number printed by System.out.println on the output of a command prompt.

On execution of code the program code show an error, identifier expected for a number, as we do not declare the data type of num. and illegal start of type  as we do not place the braces after the main static method.

javaerrormessage.java

import java.io.*;
public class javaerrormessage {

    public static void main(String args[]) throws Exception 
     
        InputStreamReader inputStreamReader = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(inputStreamReader);

        System.out.println("Enter a number : ");
        String num = br.readLine();

        int j = Integer.valueOf(num);
        for (int i = 0; i < j; i++) {
            System.out.println(i);
        }
    }

}

Output

Compiling source file to /home/girish/NetBeansProjects/errors/build/classes
/home/girish/NetBeansProjects/errors/src/javaerrormessage.java:4';' expected
    public static void main(String args[]) throws Exception 
/home/girish/NetBeansProjects/errors/src/javaerrormessage.java:9: <identifier> expected
        System.out.println("Enter a number : ");
/home/girish/NetBeansProjects/errors/src/javaerrormessage.java:9: illegal start of type

To resolve this error you have to give Brace after public static void main(String args[])throws Exception {


Download code

                         

» View all related tutorials
Related Tags: java c mac process io virtual vi number this sso ai processor to proc e il section machine ce in

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.