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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Java error class interface or enum excepted 
 

Java Error class interface or enum excepted are the class of java error that occurred when a programmer placed a brace in improper place or braces are not properly closed.

 

Java error class interface or enum excepted

                         

Java Error class interface or enum excepted are the class of java error that occurred when a programmer placed a brace in improper place or braces are not properly closed.

Understand with Example

In this Tutorial we want to describe you a code that explain you java error class or enum excepted ,For this we have a class name'InterfaceEnumexcepted',Inside the main method we have taken an instance of Date class.

 

 

Let us look to the method used in this class-

calendar.getInstance This method returns you a calendar object initialized with the current time and date.
setTime(date ) This method returns you the time set with the calendar date.
StringBuffer  This method is a mutable one that can be changed according to specified condition by calling a certain method.
append  This method returns you the concatenates the representation in string of any  type of data in  the end of the invoking of string buffer.
System.out.println This is used to display the current date.
Tostring Once the concatenation has been done, the compiler invoke  to to String( ) that turn  the modifiable StringBufer  into a constant String.

InterfaceEnumexcepted.java


import java.net.*;
import java.util.*;

public class InterfaceEnumexcepted {

    public static void main(String args[]) {

        Date date = new Date();
        Calendar cal = Calendar.getInstance();

        cal.setTime(date);

        StringBuffer sb = new StringBuffer("");

        sb.append(cal.get(Calendar.DAY_OF_MONTH));
        sb.append(".");
        
        sb.append((cal.get(Calendar.MONDAY1));
        sb.append(".");
        
        sb.append(cal.get(Calendar.YEAR));
        sb.append(" ");
        
      
        System.out.println("Today's Date is :"+sb.toString());
   } }
}
 

On the execution of the above code the compiler show a class,enum interface is expected as braces are not properly closed.
Output

Compiling source file to /home/girish/NetBeansProjects/errors/build/classes
/home/girish/NetBeansProjects/errors/src/
InterfaceEnumexcepted.java:
28: class, interface, or enum expected
}

To resolve this problem you have to check wheather curly braces are properly closed or not

Download code

                         

» View all related tutorials
Related Tags: java c memory time application object io runtime free method get order return this sso ai app with to run

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.