
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
Found 9150 Articles for Object Oriented Programming

13K+ Views
Inheritance is a relation between two classes where one class inherits the properties of the other class. This relation can be defined using the extends keyword as −public class A extends B{ }The class which inherits the properties is known as sub class or, child class and the class whose properties are inherited is super class or, parent class.In inheritance a copy of super class members is created in the sub class object. Therefore, using the sub class object you can access the members of the both classes.Multiple inheritanceThere are various types of inheritance available namely single, multilevel, hierarchical, multiple ... Read More

13K+ Views
Yes, an Enum implements an Interface in Java. It can be useful when we need to implement business logic that is tightly coupled with a specific property of a given object or class. Before implementing the interface with an enum, let's discuss enums and interfaces in Java with a code snippet for better understanding. Enum in Java In Java, an Enum (i.e., an enumeration) is a special data type added in Java version 1.5. Enums are constants by default; the names of an enum type's fields are in uppercase letters. In the Java programming language, you can define an Enum ... Read More

2K+ Views
A JLabel is a subclass of JComponent class and an object of JLabel provides text instructions or information on a GUI. A JLabel can display a single line of read-only text, an image or both text and an image. A JLabel can explicitly generate a PropertyChangeListener interface. We can also implement a moving text in a JLabel by using a Timer class, it can set a timer with speed(in milliseconds) and this as an argument.Exampleimport java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.Timer; public class MovingTextLabel extends JFrame implements ActionListener { private JLabel label; public MovingTextLabel() { setTitle("MovingTextLabel"); label= new JLabel(" ... Read More

12K+ Views
In Java, the cannot find symbol error occurs when we try to reference a variable that is not declared in the program or when we try to access a class that is not declared or imported. Possible Causes of 'Cannot Find Symbol' Error Below is a list of some possible causes of the 'cannot find symbol' error in Java - Using a variable that is not declared or outside the code. Using wrong cases ("tutorials" and "Tutorials" are different) or making spelling mistakes. The packaged class has ... Read More

156 Views
Math.asinh() and Math.acosh() functions are used to find the hyperbolic arc-sine and hyperbolic arc-cosine of a number respectively. These functions are static methods of Math, therefore they are always used as Math.asinh() and Math.acosh(), rather than as methods of a math object created.Math.asinh()This method is used to find the hyperbolic arc-sine of a number. It takes a number as a parameter and returns hyperbolic sine value.ExampleLive Demo document.write(Math.asinh(2)); document.write(""); document.write(Math.asinh(7)); Output1.4436354751788103 2.644120761058629Math.acosh()This method is used to find the hyperbolic arc-cosine of a number. It takes a number ... Read More

633 Views
This article will discuss the wait() and wait(long timeout) methods, along with a suitable example that explains when to call these methods in a thread in Java. The wait() Method In Java, the wait() method is used in multithreading and causes the current thread to "wait" until another thread calls notify() or notifyAll() on the same object. When the wait() method is called, the thread moves from the running to the waiting state and resumes only when notified, if not a deadlock will be formed. Note: Call the wait() method only when the thread should wait without any time limit. Following ... Read More

168 Views
Math.imul( )Unlike other multiplying functions, the Math.imul() function returns the result of the C-like 32-bit multiplication of the two parameters. Its application is very high in projects like Emscripten. syntaxvar product = Math.imul(a, b);This method takes two numbers and gives out their multiplication value.Example-1In the following example, two normal integers were given as parameters to the method Math.Imul() and the obtained result is displayed as shown in the output.Live Demo document.write(Math.imul(3, 4)); document.write(""); document.write(Math.imul(-3, 4)); Output12 -12Example-2In the following example, c-like 32-bit values were given as parameters to ... Read More

1K+ Views
The contents of the specified date object are converted into a string using the date.toJSON() function. Applying date() constructor, the date object is generated. Dates describe a particular moment in time. The value of the Date object is described by a string that is returned by the toJSON() function (using toISOString()). In general, this function is programmed to automatically meaningfully serialise Date objects during JSON serialisation. The DateObj is a valid Date object produced by the Date() constructor function, and its data has been transformed into a string. Here are some additional codes for the procedure mentioned below in the ... Read More

1K+ Views
The java.lang.Runtime class is a subclass of Object class, can provide access to various information about the environment in which a program is running. The Java run-time environment creates a single instance of this class that is associated with a program. The Runtime class does not have any public constructors, so a program cannot create its own instances of the class. A program must call the getRuntime() method to get a reference to the current Runtime object. The important methods of Runtime class are addShutdownHook(), exec(), exit(), freeMemory(), gc(), halt() and load(). Syntax public class Runtime extends Object Example public class RuntimeTest { ... Read More

211 Views
Symbol.isConcatSpreadableThis well-known symbol is used to configure if an object should be flattened to its array elements when using the Array.prototype.concat() method. If it is false then there is no flattening of the array takes place. By default, the Symbol.IsConcatSpreadable is true. Therefore until and unless it is not declared explicitly flattening of the array can't be avoided.Without SymbolExampleIn the following example, the symbol Symbol.IsConcatSpreadable was doesn't stated explicitly. So by default, the array was flattened as shown in the output. var arr1 = ['mango', 'apple', 'guava']; var arr2 = ['cashew', 'pista', 'bhadham']; ... Read More