Hi there,
Figured out the other part...
Now this part..
I have to convert MM/DD to word format, eg:
1/17 to 17 January
Is there an easier way to do this than if/switch/etc?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hi there,
Figured out the other part...
Now this part..
I have to convert MM/DD to word format, eg:
1/17 to 17 January
Is there an easier way to do this than if/switch/etc?
Last edited by Vinceisg0d; March 2nd, 2010 at 07:48 PM.
To create your own exception, extend Exception or RuntimeException (depending on whether you want a check or an uncheck exception)
public class MyException extends Exception {}// really no code needed, it's all in the Exception class
here simple program.
1. public class Excep16 {
public static void main(String[] args) {
try{
for(int cnt = 0; cnt < 5; cnt++){
if(cnt == 5) throw new MyException("number is 3");
}
}
catch(MyException e){
System.out.println("In exception handler, "+ "get the message\n" + e.getMessage());
}
System.out.println("Out of catch block");
}
}
2.
public class MyException extends Exception{
MyException(String message){
super(message);
}
}