How can we initialize a boolean array in Java?

Updated on 01-Dec-2023 15:02:19

19K+ Views

The boolean array can be used to store boolean datatype values only and the default value of the boolean array is false. An array of booleans are initialized to false and arrays of reference types are initialized to null. In some cases, we need to initialize all values of the boolean array with true or false. We can use the Arrays.fill() method in such cases. Syntax boolean[] booleanArray; Example import java.util.Arrays; public class BooleanArrayTest { public static void main(String[] args) { Boolean[] boolArray = new Boolean[5]; // initialize a boolean array for(int i ... Read More

What is the full form of CPT?

Praveen Varghese Thomas
Updated on 01-Dec-2023 14:53:33


Introduction Common Proficiency Test (CPT) is an entry-level examination for students who wanted to pursue a career in Chartered Accountancy (CA) in India. The exam was conducted by the Institute of Chartered Accountants of India (ICAI) and was held twice a year, usually in June and December. The CPT exam aimed to test the basic knowledge and understanding of four subjects, namely Accounting, Mercantile Laws, General Economics, and Quantitative Aptitude. Eligibility Criteria for CPT The eligibility criteria for the Common Proficiency Test (CPT), which was an entry-level examination for Chartered Accountancy (CA) in India, was as follows − ... Read More

How can we use the StringTokenizer class in Java?

Updated on 01-Dec-2023 14:52:22


A StringTokenizer is a subclass of Object class and it can allow an application to break a string into tokens. A set of delimiters can be specified either at creation time or on a per-token basis. An instance of StringTokenizer behaves in two ways depending on whether it was created with the returnDelims flag having the value true or false. The object of StringTokenizer internally maintains a current position within the string to be tokenized. The important methods of StringTokenizer c;ass are hasMoreElements(), hasMoreTokens(), nextElement(), nextToken() and countTokens(). Syntax public class StringTokenizer extends Object implements Enumeration Example 1 import java.util.*; public class StringTokenizerTest1 { ... Read More

What is the full form of CRISIL?

Praveen Varghese Thomas
Updated on 01-Dec-2023 14:51:29


Introduction Credit Rating Information Services of India Limited (CRISIL) is a leading credit rating agency in India. It is a global analytical company providing ratings, research, and risk and policy advisory services regulated by the Securities and Exchange Board of India (SEBI) and operates in compliance with relevant regulations and guidelines. CRISIL's ratings are widely used by investors, issuers, financial intermediaries, and other stakeholders to assess credit risk and make informed investment decisions. assigns credit ratings that reflect its opinion on the credit risk associated with a particular entity or financial instrument. Services offered by CRISIL Some of the ... Read More

How to save the elements of a TreeSet to a file in Java?

Updated on 01-Dec-2023 14:47:10


A TreeSet is a subclass of AbstractSet class and it does not allow duplicate elements. By default, TreeSet stores the elements in an ascending order and retrieval speed of an element out of a TreeSet is faster. The TreeSet class internally uses a TreeMap to store elements. The elements in a TreeSet are sorted according to their natural ordering. We can also save the elements stored in a TreeSet to a file by using the Arrays.asList() method and pass this set as an argument to the writeObject() method of ObjectOutputStream class. Syntax public class TreeSet extends AbstractSet implements NavigableSet, Cloneable, Serializable Example import java.util.*; import*; public ... Read More

When can we use the getClass() method in Java?

Updated on 01-Dec-2023 14:43:00


The getClass() method is from Object class and it returns an instance of the Class class. When we declare a new instance of an object, it will be referring to a class. There can only be one class per JVM but multiple object referring to it. So when we get the class of two objects, they might be referring to the same class. Syntax public final Class getClass() Example class User { private int id; private String name; public User(int id, String name) { = id; ... Read More

What is the purpose of using a dumpStack() method in Java?

Updated on 01-Dec-2023 14:39:39


The dumpStack() method is a static method of Thread class and it can be used to print or display stack tracing of the current thread to System.err. The purpose of the dumpStack() method is basically for debugging and Internally this method is calling the printStackTrace() method of Throwable class. This method does not raise any exceptions. Syntax public static void dumpStack() Example public class ThreadDumpStackTest { public static void main(String args[]) { Thread t = Thread.currentThread(); t.setName("ThreadDumpStackTest"); t.setPriority(1); System.out.println("Current Thread: " + ... Read More

What is the full form of CRT?

Praveen Varghese Thomas
Updated on 01-Dec-2023 14:38:17


Introduction Cathode Ray Tube (CRT) is a vacuum glass tube consists of multiple electron guns. They create images a beam of electrons, allowing to project the output on the phosphorescent screen. Today we see flat-screen televisions and monitors but we must remember about heavy television and computer monitors. They were big in size and heavy. That television was worked on (CRT) cathode ray tube technology. The physicist “Johann Hittorf '' discovered the Cathode rays in Crooks tube in 1869. Crooks tubes are vacuum tubes having two electrodes that are kept at high potential difference which discharge cathode rays. ... Read More

How to check if the string begins with specific substring in Java?

Updated on 01-Dec-2023 14:34:36


A String class can be used to represent the character strings, all the string literals in a Java program are implemented as an instance of a String class. The Strings are constants and their values cannot be changed (immutable) once created. We can use the startsWith() method of String class to check whether a string begins with a specific string or not, it returns a boolean, true or false. Syntax public boolean startsWith(String prefix) Example public class StringStartsWithSubStringTest { public static void main(String[] args) { String str = "WelcomeToTutorialsPoint"; if(str.startsWith("Welcome")) { ... Read More

What is the full form of CS?

Praveen Varghese Thomas
Updated on 01-Dec-2023 14:18:09


Introduction Company secretary (CS) is an executive personnel of a company that maintains the company's accounts, taxation, legal advisory and auditing. He is also a legal representative of a company. You have to appear for an entrance test and complete the company secretary course to become a company secretary. A Company secretary has knowledge of business and environment and Law, business economics, accounting and auditing, and different laws etc. It is one of the most reputed job profiles. You can earn an average salary of 6 to 7 lakhs per annum as CS. Definition of CS According to the ... Read More

1 2 3 4 5 ... 11532 Next