Maruthi Krishna has Published 870 Articles

How do I create a java.sql.Date object in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:41:48

6K+ Views

Using the ConstructorThe java.sql.Date represents the date value in JDBC. The constructor of this class accepts a long value representing the desired date and creates respective Date object.Date(long date)You can create this object using this constructor.ExampleLive Demoimport java.text.ParseException; import java.text.SimpleDateFormat; public class Demo {    public static void main(String args[]) ... Read More

What is the difference between Java and Java EE

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:39:41

1K+ Views

JSE (Java Standard Edition)By using JavaSE you can develop stand-alone application ex: adobe reader, anti-virus, media players, etc. Java SE is also known as core java.lang: Language basics.util: Collection framework, events, data structure and other utility classes such as date.io: File operations, and other input and output operations.math: Multi precision ... Read More

How to create a default constructor in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:37:53

3K+ Views

Default constructor (No-arg constructor)A no-arg constructor doesn’t accepts any parameters, it instantiates the class variables with their respective default values (i.e. null for objects, 0.0 for float and double, false for Boolean, 0 for byte, short, int and, long).There is no need to invoke constructors explicitly these are automatically invoked ... Read More

How to create a parameterized constructor in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:36:13

3K+ Views

A constructor is similar to method and it is invoked at the time creating an object of the class, it is generally used to initialize the instance variables of a class. The constructors have same name as their class and, have no return type.There are two types of constructors parameterized ... Read More

What are parametrized constructors in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:35:49

14K+ Views

A constructor is similar to method and it is invoked at the time creating an object of the class, it is generally used to initialize the instance variables of a class. The constructors have same name as their class and, have no return type.Parameterized constructorsA parameterized constructor accepts parameters with ... Read More

What is the use of parametrized constructor in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:31:10

495 Views

A constructor is similar to method and it is invoked at the time creating an object of the class, it is generally used to initialize the instance variables of a class. The constructors have same name as their class and, have no return type.There are two types of constructors parameterized ... Read More

How to use regular expression in Java to pattern match?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:27:49

310 Views

A regular expression is a string of characters that defines/forms a pattern to search an input text. A regular expression may contain one or more characters, using a regular expression you can search or replace a string.Java provides the java.util.regex package for pattern matching with regular expressions. The pattern class ... Read More

Is Java matcher thread safe in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:27:28

1K+ Views

A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. They can be used to search, edit, or manipulate text and data. Java provides the java.util.regex package for pattern matching with ... Read More

What is a sub string in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 05-Feb-2021 10:25:09

183 Views

The String class of the java.lang package represents set of characters. All string literals in Java programs, such as "abc", are implemented as instances of this class. A string index is an integer representing the position of each character in the string starting from zero.A substring is a part/segment of ... Read More

Do static variables get initialized in a default constructor in java?

Maruthi Krishna

Maruthi Krishna

Updated on 19-Nov-2020 15:41:03

7K+ Views

A static filed/variable belongs to the class and it will be loaded into the memory along with the class. You can invoke them without creating an object. (using the class name as reference). There is only one copy of the static field available throughout the class i.e. the value of ... Read More

Advertisements