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
Java Articles - Page 264 of 745
6K+ Views
The Character class is a subclass of the Object class, and it wraps a value of the primitive type char in an object. An object of type Character class contains a single field whose type is char. We can print all the capital letters of a given string using the following approaches - Using isUpperCase() Method Using ASCII Comparison Using isUpperCase() Method The isUpperCase() is the method of the Character class. It accepts a character as a parameter and returns true if it is an uppercase letter and false if not.To ... Read More
2K+ Views
An Iterable interface is defined in java.lang package and introduced with Java 5 version. An object that implements this interface allows it to be the target of the "for-each" statement. This for-each loop is used for iterating over arrays and collections. An Iterable interface can also be implemented to create custom behavior. Syntax public interface Iterable Example import static java.lang.String.format; import java.util.*; // Person class class Person { private String firstName, lastName; private int age; public Person(){ } public Person(String firstName, String lastName, int age) { this.firstName = firstName; ... Read More
26K+ Views
A method in Java is a set of statements that can be reused in the program whenever we want. We can write a method once and call it multiple times. We can return values from a method; the datatype of the value we return is known as the return type. We return values from a Java method using a return statement. A return statement causes the program control to transfer back to the caller of a method. Every method in Java is declared with a return type, ... Read More
34K+ Views
Java supports file-handling; it provides various classes that provide various methods to read, write, update, and delete data from files in our local system. A properties file is a simple text file with a ".properties" extension that contains configuration data in the form of key-value pairs. It is mostly used in Java applications to manage settings such as database configuration, application messages, or environment variables. How to read Data from a Properties File in Java? To read data from the properties file, you can use the Properties class in Java. This is a subclass of the Hashtable class and it represents a persistent ... Read More
2K+ Views
A static inner class can be instantiated without the need for an instance of the outer class. In general, an Inner class is a part of nested class, called Non-static nested classes in Java. The types of inner classes are member inner class, anonymous inner class, and local inner class. We can instantiate a static inner class with reflection using InnerClass.class.newInstance(). If we need an instance of the outer class to instantiate a non-static inner class, we can specify it before a new operator. Example import java.lang.reflect.*; public class InnerclassWithReflectionTest { public static void main(String args[]) { ... Read More
21K+ Views
Yes, the finally block will be executed even after a return statement within a try or catch block in a Java method. Finally Block after the Return Statement Usually, the return statement will be the last in a Java method. If you try to add any statements after the return in Java, an error will be generated. public class Sample { public String demoMethod() { System.out.println(); return null; System.out.println("This statement will generate an error"); } ... Read More
12K+ Views
Bitwise XOR (exclusive or) "^" is an operator in Java that provides the answer '1' if both of the bits in its operands are different; if both of the bits are the same, then the XOR operator gives the result '0'. XOR is a binary operator that is evaluated from left to right. The operator "^" is undefined for the argument of type String. Importance of the XOR (^) Operator in Java In Java, the XOR (^) operator is important for both bitwise and boolean operations. It returns true or 1 only when the two operands "differ". XOR is commonly ... Read More
2K+ Views
Input and output Streams in Java are objects that accepts sequence of information and sends them further. These are used to read and write data from/to various sources.What are Output Streams & WritersA Java output streams accept output data (bytes) from a source and sends it to the destination. An output stream is represented by an abstract class known as OutputStream. This is the super class of all the OutputStream classes. There are various output streams in Java namely, ByteArrayOutputStream, FileOutputStream, FilterOutputStream, ObjectOutputStream, PipedOutputStream.Writers are objects that are used to write data to character streams. These are represented by the abstract ... Read More
5K+ Views
A Character class is a subclass of the class named Object, and it wraps a value of the primitive type char. An object of type Character contains a single field whose type is char. Unicode Category of a Character In Java, the Unicode category of a character refers to the classification of characters based on their general type or usage, such as letters, digits, punctuation, symbols, etc. The java.lang.Character class provides methods to find the category of a character according to the Unicode standard. Unicode Category of a Character using getType() One of the basic ways to find the Unicode ... Read More
606 Views
In Java, formatted text refers to those text that has been processed and arranged according to a specific format. According to the article, we will use the printf() method to learn how to print the formatted text. Formatted Text using printf() Method In Java, to print the formatted output or text we have a printf() method. The printf() method allows us to format output to a java.io.PrintStream or java.io.PrintWriter. These classes also contain a method called format() which can produce the same results, so whatever we read here for the printf() method can also be applied to the format() method. ... Read More