Reply from CharlesChemai on Apr 30 at 5:01 AM Ok I got it changed Line :Singleton.INSTANCE.sayHello( ); { to Singleton.INSTANCE.sayHello( ); } and Line :public class SingletonImpl implements Singleton{ to public class SingletonImpl {
| | | ---------------Original Message--------------- From: CharlesChemai Sent: Monday, April 30, 2012 4:45 AM Subject: Singletone enum with Two Methods I have A Singletone enum with two methods public void createList() and public void sayHello(), and a SingletoneImpl Class with main as Singleton.INSTANCE.createList( );and Singleton.INSTANCE.sayHello( ); Why do I get error reached end of file while parsing? 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"); } } 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( ); { } | | Reply to this email to post your response. __.____._ | _.____.__ |
No comments:
Post a Comment