Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyException extends Exception{
- MyException(String S){
- super(S);
- }
- }
- class Exc1{ //o/p sahi nahi aa raha
- public static void main(String args[]){
- if(args[0]=="Hello"){
- System.out.println("String is right");
- }
- else{
- try{
- throw new MyException("invalid string");
- }
- catch(MyException e){
- e.getMessage();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment