Results 1 to 2 of 2
  1. #1
    vishnugch is offline Member
    Join Date
    Aug 2009
    Rep Power

    Question default access modifier

    default class Base
    void me()
    System.out.println("I am in Base");
    public class Declare extends Base

    public static void main(String[] args)
    System.out.println("Hello World!");
    Base b1=new Declare();;

    when i execute this on my system with jdk1.6 i am encountered with an error at compile time asking for an Interface or class or an enum .
    please provide me why this happens with "default".

    Thanx in advance

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    'default' is not valid in a class declaration - it is only used in a 'switch' statement.

    Why did you use it there?

Similar Threads

  1. why cant a top most class has staic modifier
    By srikantha in forum New To Java
    Replies: 4
    Last Post: 08-06-2009, 06:03 PM
  2. Regarding default access modifier?
    By makpandian in forum New To Java
    Replies: 2
    Last Post: 03-14-2009, 08:21 AM
  3. Replies: 1
    Last Post: 03-10-2009, 01:12 PM
  4. why we use public access modifier?
    By vichet in forum New To Java
    Replies: 1
    Last Post: 04-04-2008, 07:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts