
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

360 Views
The Arrays class of the java.util package provides a method named toString() this method accepts an array value (of any type) and returns a String.ExampleFollowing Java program accepts various arrays from the user, converts them into String values and prints the results. Live Demoimport java.util.Arrays; import java.util.Scanner; public class ObjectArrayToStringArray { public static void main(String args[]){ Scanner sc = new Scanner(System.in); //Integer array to String System.out.println("Enter 5 integer values: "); int intArray[] = new int[5]; for(int i=0; i

1K+ Views
An interface in Java is similar to class but, it contains only abstract methods and fields which are final and static.Just like classes you can extend one interface from another using the extends keyword as shown below −interface ArithmeticCalculations{ public abstract int addition(int a, int b); public abstract int subtraction(int a, int b); } interface MathCalculations extends ArithmeticCalculations{ public abstract double squareRoot(int a); public abstract double powerOf(int a, int b); }But, when you implement the sub-class you need to provide body for the abstract methods in both interfaces.ExampleIn the following example we have created two interfaces ... Read More

3K+ Views
In this article, we will learn to implement a JLabel text with different colors and fonts in Java. JLabel is commonly used for simple text display, it can be enhanced to show text with multiple colors and fonts. JLabel A JLabel class can extend the 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. Different Approaches The following are the two different approaches to implementing a JLabel text ... Read More

508 Views
In this article, we will learn to insert multiple tabs into a single JTabbedPane in Java. The Java Swing's JTabbedPane enables you to group content into several tabs in one container. JTabbedPane A JTabbedPane is a component can extends the JComponent class, and we can able to see only one tab at a time. Each tab is associated with a single component that can be displayed when the tab is selected. Syntax Object declaration and instantiation using the Java class JTabbedPane: JTabbedPane tabbedPane = new JTabbedPane(); A JTabbedPane can generate a ChangeListener interface when a tab is ... Read More

5K+ Views
In this article, we will learn to draw a rounded rectangle using the Graphics object in Java. Drawing shapes is a basic feature of Java 2D graphics programming. Though the Graphics class offers methods for drawing common rectangles, drawing rounded rectangles involves some special techniques. Graphics Class In Java, the drawing takes place via a Graphics object, which is an instance of the java.awt.Graphics class. Each Graphics object has its own coordinate system, and all the methods of Graphics, including those for drawing Strings, lines, rectangles, circles, polygons, etc. We can get access to the Graphics object through the paint(Graphics ... Read More

456 Views
In this article, we will learn to implement an editable JLabel in Java. An editable JLabel is a label component that can be converted to an editable text field when clicked. JLabel A JLabel class can extend the 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 image. Syntax The following is the syntax for JLabel initialization: JLabel label = new JLabel("Tutorials Point"); A JLabel can explicitly generate a PropertyChangeListener interface. Methods The important methods of a ... Read More

1K+ Views
JComboBoxA JComboBox can extend JComponent class and it is a combination of a text field and a drop-down list from which the user can choose a value.If the text field portion of the control is editable, the user can enter a value in the field or edit a value retrieved from the drop-down list.By default, the user not allowed to edit the data in the text field portion of the JComboBox. If we want to allow the user to edit the text field, call setEditable(true) method.A JComboBox can generate an ActionListener, ChangeListener or ItemListener when the user actions on a combo box.A ... Read More

4K+ Views
JPanelA JPanel is a subclass of JComponent (a subclass of a Container class). Therefore, JPanel is also a Container.A JPanel is an empty area that can be used either to layout other components including other panels.In a JPanel, we can add fields, labels, buttons, checkboxes, and images also.The Layout Managers such as FlowLayout, GridLayout, BorderLayout and other layout managers helps us to control the sizes, positions, and alignment of the components using JPanel.The important methods of a JPanel class are getAccessibleContext(), getUI(), updateUI() and paramString().We can also implement a JPanel with vertical and horizontal scrolls by adding the panel object to JScrollPane.Exampleimport java.awt.*; ... Read More

1K+ Views
In this article, we will learn to select one item at a time from a JCheckBox in Java. When creating Java Swing applications, you might have situations where you need checkboxes to behave like radio buttons, such that a box can be checked singly at any given time. JCheckBox A JCheckBox can extend JToggleButton, and it can be a small box that is either checked or unchecked. When we click on a JCheckBox, it changes from checked to unchecked or vice versa automatically. Syntax The following is the syntax for JCheckBox initialization: JCheckBox checkBox = new JCheckBox("Option"); A JCheckBox can ... Read More

6K+ Views
You can convert a character to upper case using the toUpperCase() method of the character class.ExampleFollowing program converts alternate characters of a string to Upper Case. Live Demoimport java.util.Scanner; public class UpperCase { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter a string :"); String str = sc.nextLine(); str = str.toLowerCase(); char[] ch = str.toCharArray(); for(int i=0; i