Jai Janardhan has Published 70 Articles

Find the Extreme elements in a List in Java

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:24

361 Views

The extreme elements in a list are the maximum and minimum elements. These can be obtained using the java.util.Collections.max() and java.util.Collections.min() methods respectively.The Collections.max() method contains a single parameter i.e. the list whose maximum element is to be found and it returns the maximum element from the list. The Collections.min() ... Read More

Swap two variables in one line in Java

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:23

1K+ Views

In order to swap two variable using single expression or in single line we could use bitwise XOR operator of Java. As we now that in Java XOR functions as XOR of two numbers a and b returns a number which has all the bits as 1 wherever bits of ... Read More

String compare by equals() method in Java

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:21

83 Views

The equals() method of the String class compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.Example Live Demopublic class Test {    public static void ... Read More

remove null value from a String array in Java

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:21

3K+ Views

Following program creates an array with null values. Convert it a list with not-null values only and then get the array of that list.Exampleimport java.util.ArrayList; import java.util.List; public class Tester { public static void main(String[] args) { String[] array = {"I", ... Read More

Trigraphs in C++

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:21

183 Views

The ISO-646 character set does not have all the characters of the C syntax, therefore there are some systems with keyboards and displays that cannot deal with some characters. These characters can be constructed using a sequence of 3 characters called trigraphs. In C, before any other processing takes place, ... Read More

Why java is both compiled and interpreted language.

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:21

578 Views

Yes, a java program is first compiled into bytecode which JRE can understand. ByteCode is then interpreted by the JVM making it as interpreted language.

Regular Expressions syntax in Java Regex

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:21

170 Views

Following is a simple program demonstrating how to use regular expression in Java. Java Regex Characters

What is the package for String Class in Java?

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:21

3K+ Views

String class belongs to the java.lang package.

What is string constant pool in Java?

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:21

608 Views

When you store a String asString str1 = "Hello";directly, then JVM creates a String object with the given value in a separate block of memory known as String constant pool.And whenever we try to create another String asString str2 = "Hello";JVM verifies whether any String object with the same value ... Read More

What are final, abstract, synchronized non-access modifiers in Java?

Jai Janardhan

Jai Janardhan

Updated on 30-Jul-2019 22:30:20

263 Views

The abstract keyword is used to declare methods abstract methods and abstract classes. Once a method is declared abstract we should not specify body for those. And once a class is declared abstract it cannot be instantiated. Example Live Demo abstract class Employee { private ... Read More

Previous 1 ... 3 4 5 6 7
Advertisements