Java String charAt() method

It returns the char value present in the string at the specified index. Here,  index value can not be greater than length() -1. Syntax: public char charAt (int index) 123  public char charAt (int index)  Parmeters It accepts only one parameter that is the...

Java Enhanced For Loop (For-each Loop)

JAVA ENHANCED FOR LOOP The enhanced for loop is also called the for-each loop and has some advantages over the regular for loop. A for-each loop is designed to cycle through a collection of objects, sequentially from start to finish. The general form of the for-each...

Java For Loop

A for loop is used to execute a set of statements for a fixed number of times. It takes the following form: for (initialization; condition; update) { statements; } 12345  for (initialization; condition; update) {statements;}  The for loop defines three types...

Java Do While Loop

When we wish to test the exit condition at the end of the loop, we use a do-while loop. The do-while loop always executes its body at least once, because its conditional expression is at the bottom of the loop. Example: public class Myclass { public static void...

Java Arrays

An array is an object that stores a collection of values. An array can store two types of collection data: objects and primitives. An array is a collection of values which are heap memory addresses. In the case of primitive, it stores direct value, and in case of an...

Java Characters

Normally, when we work with characters, we use primitive data types char. When we have to work with the objects of char, we use Character class. Character class has many important methods to manipulate characters. Example: char primitive is created by char ch = ‘A’;...

Java Numbers

We use primitive data types like byte, int, long, double, etc to work with the numbers, When we need objects, we use wrapper class like Integer, Double, Long, Byte, etc. All the wrapper classes (Integer, Long, Byte, Double, Float, Short) are subclasses of the abstract...

Java Network Programming (Socket Programming in Java)

JAVA NETWORK Network programming is used to execute programs across multiple machines that are connected by a network. The java.net package contains a collection of classes and interfaces that provide this functionality. The java.net package provides support for the...

Pin It on Pinterest