Found 2620 Articles for Java

How to set Temporary and Permanent Paths in Java?

raja
Updated on 11-Feb-2020 07:39:28

19K+ Views

There are two ways to set the path in java, First is Temporary Path and second is Permanent Path.Setting Temporary PathOpen command prompt in WindowsCopy the path of jdk/bin directory where java located (C:\Program Files\Java\jdk_version\bin)Write in the command prompt: SET PATH=C:\Program Files\Java\jdk_version\bin and hit enter command.Setting Permanent PathGo to My Computer ---> Right Click on it ---> Advanced System Settings ---> Advanced Tab ---> Click on Environment VariablesClick on New tab of User variables, assign value JAVA_HOME to Variable Namejava\jdk_version\bin path (copied path) to Variable Value and click on OK ButtonFinally, click on OK button.Read More

Java Program to check if two dates are equal

Samual Sam
Updated on 10-Aug-2023 12:47:18

151 Views

The date is a way of keeping track of our time as it is an integral part of our daily lives. In the programming world, there are a few scenarios where we are required to deal with the date and time such as while developing a calendar application and attendance management system in Java. Therefore, Java provides a few built-in classes like Date and LocalDate to work with date and time. In this article, we are going to explore Java programs to check whether two given dates are equal or not. Java Program to Check if two Dates are Equal ... Read More

Java Program to compare two sets

Krantik Chavan
Updated on 10-Aug-2023 12:59:11

634 Views

The Java Collection Framework provides an interface named Set that extends the Collection interface and serves to store unique elements. It depicts the features of a mathematical set. Hence, it allows all those operations that we can perform on a mathematical set such as union, comparison, intersection and so forth. The agenda of this article is to write Java programs to copare two sets. For the comparison operation of two sets, Java provides a built-in method 'equals()' that we will discuss in the next section. Java Program to Compare two Sets We are going to use the following class and ... Read More

Java Program to compare dates if a date is after another date

karthikeya Boyini
Updated on 10-Aug-2023 12:57:20

381 Views

In the world of Java programming, there are a few scenarios where we are required to deal with the date and time such as while developing a calendar application, attendance management system in Java and checking age of two persons. Also, the date is a way of keeping track of our time as it is an integral part of our daily lives. Therefore, Java provides classes like Date and LocalDate to work with date and time. And, to compare and check if a date is after another or not, it provides a few useful built-in methods like 'compareTo()' and 'after()'. ... Read More

Java Program to check the beginning of a string

Samual Sam
Updated on 10-Aug-2023 12:52:28

141 Views

A string is a class in Java that stores a series of characters enclosed within double quotes. Those characters are actually String-type objects. The string class is available in the 'java.lang' package. Suppose we have given a string and our task is to find the beginning of that string. Let's assume the beginning as the first two or three characters of that string. To check the beginning of a string, we can use several built-in methods available in Java including substring() and charAt(). Java Program to Check the Beginning of a String To check the beginning of a string we ... Read More

Java program to count words in a given string

karthikeya Boyini
Updated on 10-Aug-2023 13:01:36

10K+ Views

A string is a class in Java that stores a series of characters enclosed within double quotes. Those characters act as String-type objects. The aim of this article is to write Java programs that count words in a given string. Counting words of the given strings can be solved using the string manipulation techniques. In Java interviews, questions from string manipulation are very frequent, hence, it is important to understand this problem properly. Java Program to Count Words in a given String Before jumping to the example programs, let's understand the problem statement with the help of an example. Input ... Read More

Java Program to convert a String to int

karthikeya Boyini
Updated on 10-Aug-2023 13:06:22

233 Views

To convert a String to int in Java, we can use the two built-in methods namely parseInt() and valueOf(). These static methods belong to the Integer class of java.lang package and throws a NumberFormatException if the string is not a valid representation of an integer. In Java, String is a class of 'java.lang' package that stores a series of characters enclosed within double quotes. And, an integer is a primitive datatype that stores numerical values. In this article, we will discuss a few Java programs that illustrate how to convert a given String to integer. Java Program to Convert a ... Read More

Java and multiple inheritance

Arjun Thakur
Updated on 10-Aug-2023 12:01:11

6K+ Views

In Java, we use inheritance to allow the creation of a hierarchical classification of classes and objects. As the name suggests, inheritance is the ability of a class to inherit members of another class. The class whose properties are inherited is called a superclass whereas the class that inherits a superclass is called a subclass. We use the extends keyword to inherit the class. There are several types of inheritance in Java such as single and multilevel. In this article, we will specifically explore the multiple inheritance. Multiple Inheritance in Java In the terminology of object-oriented programming, multiple inheritance is ... Read More

Comparison of Java and .NET

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

233 Views

Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. .NET framework is a computer software framework invented by Microsoft. It runs on Microsoft Windows OS (Operating Systems). It provides user interface, data access, database connectivity, cryptography, web application development, etc. Languages Java supports only Java patterns. .NET supports multiple languages such as VB.NET, C#, F#, etc. Platforms Java is platform independent and it can run on Windows, Linux and Mac OS. .NET works on Windows. Runtime ... Read More

Why Java programs running on Android systems do not use the standard Java API and virtual machine?

David Meador
Updated on 22-Jun-2020 15:09:37

490 Views

The standard Java API and virtual machine are mainly designed for desktop as well as server systems. They are not that compatible with mobile devices. Because of this, Google has created a different API and virtual machine for mobile devices. This is known as the Dalvik virtual machine.The Dalvik virtual machine is a key component of the Android runtime and is a part of JVM (Java Virtual Machine) developed specially for Android. The Dalvik virtual machine uses features that are quite important in Java such as memory management, multi-threading etc. The programs in Java are first converted into JVM and ... Read More

Advertisements