Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2558 of 3363
34K+ Views
We can develop a login form in Java using Java Swing technology. In this example, we can create two labels username and password, two text fields for the user to enter valid credentials, and finally, one submit button. Once the user is able to enter the valid credentials in the two text fields, we can able to see Hello admin in the login form. Setting Up the Project We’ll use Java Swing, a GUI toolkit for building desktop applications. Required Libraries are: javax.swing.* (for Swing components) java.awt.* (for layout management) ... Read More
2K+ Views
Let's discuss the differences between errors and exceptions.Recovering from Error is not possible. The only solution to errors is to terminate the execution. Whereas we can recover from Exception by using either try-catch blocks or throwing an exception back to the caller.You will not be able to handle the Errors using try-catch blocks. Even if you handle them using try-catch blocks, your application will not recover if they happen. On the other hand, Exceptions can be handled using try-catch blocks and can make program flow normally if they happen.Exceptions are related to the application whereas Errors are related to the ... Read More
3K+ Views
Basically, PHP is interpreted but PHP is compiled down to an intermediate bytecode that is then interpreted by the runtime Zend engine.PHP compiler is responsible forconvert the code to a bytecode that can be used by the runtime engine.resolve functions, names and classes namescreating a symbol tablePHP Interpreter doesGoes through the bytecode line by line and executes itHandles runtime exception
6K+ Views
PHP allows the user to modify some of its settings mentioned in php.ini using ini_set(). This function requires two string arguments. The first one is the name of the setting to be modified and the second one is the new value to be assigned to it.Parametersvar nameNot all the available options can be changed using ini_set(). There is a list of all available options in the appendix.new valueThe new value for the option.ExampleGiven the line of code will enable the display_error setting for the script if it’s disabled. We need to put the above statement, at the top of the ... Read More
484 Views
In this article, we will learn how an IllegalStateException (unchecked) is thrown in Java. IllegalStateException is a subclass of RuntimeException. It occurs when a method is used at the wrong time or when an object is not in the right state. What is an IllegalStateException? An IllegalStateException is an unchecked exception in Java. This exception may arise in our Java program mostly if we are dealing with the collection framework of java.util.package. There are many collections, such as List, Queue, Tree, and Map, of which List and Queues (Queue and Deque) throw this IllegalStateException under particular conditions. When will ... Read More
10K+ Views
In Java, the exceptions are of two types: checked and unchecked exceptions. A checked exception is an exception that occurs at compile time; these are also called compile-time exceptions. An unchecked exception occurs at the time of execution. These are also called Runtime Exceptions. In this article, we will learn to create a custom unchecked exception in Java. We can create a custom unchecked exception by extending the RuntimeException class in Java. What are unchecked exceptions? The unchecked exceptions inherit from the Error class or the RuntimeException class. Many programmers feel that we cannot handle these exceptions in our programs because they represent the type of errors ... Read More
3K+ Views
A static method is the one which you can call without instantiating the class. If you want to call a static method of the superclass, you can call it directly using the class name.Example Live Demopublic class Sample{ public static void display(){ System.out.println("This is the static method........"); } public static void main(String args[]){ Sample.display(); } }OutputThis is the static method........It also works, if you call a static method using an instance. But, it is not recommended. Live Demopublic class Sample{ public static void display(){ System.out.println("This is the static ... Read More
3K+ Views
Inheritance can be defined as the process where one (parent/super) class acquires the properties (methods and fields) of another (child/sub). With the use of inheritance, the information is made manageable in a hierarchical order. The class which inherits the properties is known as a subclass and the class whose properties are inherited is called superclass. In short, in inheritance, you can access the members (variables and methods) of the superclass using the subclass object.Example Live Democlass SuperClass { public void display(){ System.out.println("Hello this is the method of the superclass"); } } public class SubClass extends SuperClass ... Read More
3K+ Views
A super keyword is a reference of the superclass object in Java. Using this, you can invoke the instance methods constructors and, variables, of a superclass.Calling the constructor of a superclassYou can call the constructor of a superclass from the subclass’s constructor.ExampleConsider the following example, it has two classes SuperClass class and SubClass where the SubClass extends the SuperClass. The superclass has a parameterized constructor, we are invoking it from the subclass using the "super" keyword. Live Democlass SuperClass{ SuperClass(int data){ System.out.println("Superclass's constructor: "+data); } } public class SubClass extends SuperClass{ SubClass(int data) { ... Read More
1K+ Views
The "this" keyword in Java is used as a reference to the current object, within an instance method or a constructor. Using it, you can refer the members of a class such as constructors, variables, and methods.Assigning reference to "this"According to the definition "this" is a keyword which acts as a reference to the current object (the object from whose constructor/method you are using it), its value id is fixed. Therefore, you cannot assign a new reference value to it. Moreover, it is just a keyword, not a variable.Still, if you try to it assign a reference value to "this" it ... Read More