- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2616 Articles for Java
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
28K+ Views
Using the Date classYou can create a Date object using the Date() constructor of java.util.Date constructor as shown in the following example. The object created using this constructor represents the current time.ExampleLive Demoimport java.util.Date; public class CreateDate { public static void main(String args[]) { Date date = new Date(); System.out.print(date); } }OutputThu Nov 02 15:43:01 IST 2018Using the SimpleDateFormat classUsing the SimpleDateFormat class and the parse() method of this you can parse a date string in the required format and create a Date object representing the specified date.ExampleLive Demoimport java.text.ParseException; ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
788 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 arithmetics.nio: Non-blocking I/O framework for Java.net: Classes an API’s related to networking.security: This package provides classes and interfaces such as key generation, encryption, and decryption which belongs to the security framework.sql: Classes and interfaces for accessing/manipulating the data stored in databases and data sources.awt: Classes and interfaces to create GUI ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
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 at the time of instantiation.Rules to be rememberedWhile defining the constructors you should keep the following points in mind.A constructor does not have return type.The name of the constructor is same as the name of the class.A constructor cannot be abstract, final, static and Synchronized.You can use the access specifiers ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
2K+ 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 constructors and no-arg constructors.Parameterized constructorsA parameterized constructor accepts parameters with which you can initialize the instance variables. Using parameterized constructor, you can initialize the class variables dynamically at the time of instantiating the class with distinct values.Examplepublic class StudentData { private String name; private int age; ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
13K+ 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 which you can initialize the instance variables. Using parameterized constructor, you can initialize the class variables dynamically at the time of instantiating the class with distinct values.Syntaxpublic class Sample{ Int i; public sample(int i){ this.i = i; } }ExampleLive Demopublic class Test { ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
5K+ 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.Return type of a constructorA constructor doesn’t have any return type.The data type of the value retuned by a method may vary, return type of a method indicates this value.A constructor doesn’t return any values explicitly, it returns the instance of the class to which it belongs.ExampleFollowing is an example of a constructor in java −Live Demopublic class Sample{ public Sample(){ ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
372 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 constructors and no-arg constructors a parameterized constructor accepts parameters.The main purpose of a constructor is to initialize the instance variables of a class. Using a parameterized constructor, you can initialize the instance variables dynamically with the values specified at the time of instantiation.public class Sample{ Int i; public ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
197 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 of this package is a compiled representation of a regular expression. To match a regular expression with a String this class provides two methods namely −compile(): This method accepts a String representing a regular expression and returns an object of the Pattern object.matcher(): This method accepts a String value and creates ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
721 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 regular expressions.Matcher classA Matcher object is the engine that interprets the pattern and performs match operations against an input string. Like the Pattern class, Matcher defines no public constructors. You obtain a Matcher object by invoking the matcher() method on a Pattern object.The Instances of this class are not safe ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
107 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 a string. You can identify a substring of a string using the substring() method of the String class. This method have two variants −substring(int beginIndex)This method accepts an integer value representing an index in the current string and returns the substring starting from the given index to the end of ... Read More