Java Tutorials
Top 25 JMS (Java Message Service) Interview Questions & Answers
Download PDF 1) What is JMS? JMS means Java Messaging Service. It is the new standard for inter client...
User Defined Exception or custom exception is creating your own exception class and throws that exception using ‘throw’ keyword. This can be done by extending the class Exception.
class JavaException{
public static void main(String args[]){
try{
throw new MyException(2);
// throw is used to create a new exception and throw it.
}
catch(MyException e){
System.out.println(e) ;
}
}
}
class MyException extends Exception{
int a;
MyException(int b) {
a=b;
}
public String toString(){
return ("Exception Number = "+a) ;
}
}
Step 2) Save , Compile & Run the code. Excepted output -
Download PDF 1) What is JMS? JMS means Java Messaging Service. It is the new standard for inter client...
What is Interface? The interface is a blueprint that can be used to implement a class. The...
Java String endsWith() The Java String endsWith() method is used to check whether the string is...
How to read a file in Java? Java provides several mechanisms to read from File. The most useful...
What is Inheritance? Inheritance is a mechanism in which one class acquires the property of...
What is an Array? An array is an object that can store a collection of items . Arrays become...