How to Run a JAR file from Command Prompt - Windows and UNIX [Example]

So you got a JAR file that contains your favorite Java game and you are wondering how to run a Java program from a JAR  file? Or you may be simply trying your hand after running the Java program from the command prompt and Eclipse IDE. Anyway, it's good to know How to execute Java programs from the JAR file, as the JAR file is the most popular way of shipping Java programs. JAR file usually contains all sources and resources in the form of class files, images, sound files, etc. 

How to create User Defined Exception class in Java? Example Tutorial

Java has very good support for handling Errors and Exceptions, It has a well-defined Exception hierarchy and language level support to throw and catch Exceptions and deal with them. Java Programmers often deal with built-in exceptions from java.lang package and several others which are already defined in JDK API like NullPointerException. If you have read Effective Java, you may remember the advice of Joshua Bloch regarding Exception. According to him, you should try to reuse the Exception classes provided in the JDK, like IndexOutOfBoundException, ArithmeticException, IOException, and java.lang.ArrayIndexOutOfBoundsException , instead of creating new ones for a similar purpose.

Polymorphism and Open Closed Design Principle Example in Java

Java is an object-oriented programming language that allows developers to create complex software applications by organizing code into objects. One of the key features of object-oriented programming is Polymorphism. Polymorphism refers to the ability of objects to take on different forms, depending on the context in which they are used. In Java, polymorphism is achieved through two mechanisms: inheritance and interfaces. In this blog post, I will explain what polymorphism is in Java, how it works, and provide examples to illustrate its usage. We will also discuss the benefits of using polymorphism in your Java programs, as well as some best practices for implementing it effectively.