I have this Singleton class:

package com.CCharles.Singleton;
import java.util.ArrayList;



     public enum Singleton{

        INSTANCE;
         public void createList(){  
        ArrayList arrayList = new ArrayList();
        for(int i=1;i<101;i++)
        {

        arrayList.add("Job "+i);

        }
        for(int i=1;i<101;i++)
        {

        System.out.println(arrayList.get(3));

        }

        System.out.println("DONE");

        }

        public void sayHello(){

        System.out.println("Hello World");

    }   

    }

and I am accessing Using:

package com.CCharles.Singleton;
import com.CCharles.Singleton.Singleton;

   public class SingletonImpl implements Singleton{


     public static void main(String[]args){ 
    Singleton.INSTANCE.createList( );
    Singleton.INSTANCE.sayHello( );
    {



}

I wonder Why I can't be able to parse(I get compile error 'reached end of file while parsing').

Recommended Answers

All 2 Replies

On line 10 you have a { where you should have a }

Got IT! Also changed Line 4

public class SingletonImpl implements Singleton{

to

public class SingletonImpl {

Thank You I was starting to panik..

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.