- 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
Narasimha Murthi has Published 23 Articles
Narasimha Murthi
3K+ Views
To compare two objects the object class provides a method with name equals(), this method accepts an object and compares it with the current object. If the references of these two objects are equal, then it returns true else this method returns false.ExampleIn the following example we have a class ... Read More
Narasimha Murthi
2K+ Views
Java Garbage collector tracks the live object and objects which are no more need are marked for garbage collection. It relieves developers to think of memory allocation/deallocation issues.When an object created in Java program is no longer reachable or used it is eligible for garbage collection.Following are some scenarios where ... Read More
Narasimha Murthi
2K+ Views
The this is a keyword in Java which is used as a reference to the object of the current class, with in an instance method or a constructor. Using this you can refer the members of a class such as constructors, variables and methods.Using “this” you can −Differentiate the instance ... Read More
Narasimha Murthi
661 Views
When a class has two or more methods by the same name but different parameters, at the time of calling based on the parameters passed respective method is called (or respective method body will be bonded with the calling line dynamically). This mechanism is known as method overloading.Example Live Demopublic class ... Read More
Narasimha Murthi
739 Views
To convert a Date object to LocalDate object in Java −Convert the obtained date object to an Instant object using the toInstant() method.Instant instant = date.toInstant();Create the ZonedDateTime object using the atZone() method of the Instant class.ZonedDateTime zone = instant.atZone(ZoneId.systemDefault());Finally, convert the ZonedDateTime object to the LocalDate object using the toLocalDate() method.LocalDate ... Read More
Narasimha Murthi
4K+ Views
Java provides a class named Period in the java.time package. This is used to calculate the time period between two given dates as days, months and, years etc.The between() method of this class accepts two LocalDate objects and finds out the period between the two given dates (number of years, ... Read More
Narasimha Murthi
2K+ Views
The java.text package provides a class named SimpleDateFormat which is used to format and parse dates in required manner (local).Using the methods of this class you can parse String to Date or, format Date to String.Formatting Date to StringYou can format a given String to Date object using the parse() ... Read More
Narasimha Murthi
89 Views
You can search for a particular letter in a string using the indexOf() method of the String class. This method which returns a position index of a word within the string if found. Otherwise it returns -1.Example Live Demopublic class Test { public static void main(String args[]){ ... Read More
Narasimha Murthi
233 Views
This method belongs to the System class of the java.lang package. It terminates the current JVM (Java Virtual Machine).This method accepts an integer value representing the status code, it accepts two values 0 or, 1 or, -1. Where, 0 indicates a successful termination and 1 or, -1 indicates an unsuccessful ... Read More
Narasimha Murthi
2K+ Views
Overloading is a one of the mechanisms to achieve polymorphism where, a class contains two methods with same name and different parameters.Whenever you call this method the method body will be bound with the method call based on the parameters.Overloading private methodsYes, we can overload private methods in Java but, ... Read More