AmitDiwan has Published 10740 Articles

Precision Handling in Java

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:46:45

613 Views

Let us see how precisions are handled in Java −Example Live Demoimport java.io.*; import java.lang.*; public class Demo{    public static void main(String[] args){       double my_val = 34.909;       System.out.println("The formatted value of 34.909 is ");       System.out.println(String.format("%.7f", my_val));       double my_val_2 ... Read More

Logical Operators on String in Java

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:45:22

688 Views

Let us implement logical operators on String in Java −Example Live Demoimport java.io.*; public class Demo{    public static void main(String[] args){       int a = 45, b = 32, c = 87, d = 1;       System.out.println("The first variable is " + a);       ... Read More

Complex Numbers in Java

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:43:26

7K+ Views

Complex numbers are those that have an imaginary part and a real part associated with it. They can be added and subtracted like regular numbers. The real parts and imaginary parts are respectively added or subtracted or even multiplied and divided.Example Live Demopublic class Demo{    double my_real;    double my_imag; ... Read More

How to check if a string is a valid keyword in Java?

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:41:23

1K+ Views

To check if a string is a valid keyword in Java, the code is as follows −Example Live Demoimport java.util.*; public class Demo{    static boolean valid_identifier(String my_str, int n){       if (!((my_str.charAt(0) >= 'a' && my_str.charAt(0) = 'A' && my_str.charAt(1) = 'a' && my_str.charAt(i) = 'A' && my_str.charAt(i) ... Read More

Working with csv files in Java

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:37:10

408 Views

OpenCSV has to be installed first, which is a parser library for Java. The dependency has to be mentioned in the pom.xml file in the maven project. After that, the below code can be utilized.Exampleimport java.io.FileReader; import java.io.*; public class Demo{    public static void readDataLineByLine(String file){       ... Read More

Class and Static Variables in Java

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:34:45

7K+ Views

Class variables are also known as static variables, and they are declared outside a method, with the help of the keyword ‘static’.Static variable is the one that is common to all the instances of the class. A single copy of the variable is shared among all objects.Example Live Demopublic class Demo{ ... Read More

Object Graph in Java Serialization

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:30:43

872 Views

An object graph contains a set of objects that are automatically serialized given that the object that contains the reference is serialized too. Any object that is serialized and contains an object reference, the object reference will be serialized by the JVM.Example Live Demoimport java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; ... Read More

What’s the connection between Java and Blockchain?

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:28:52

237 Views

Blockchain has become a buzz word in the recent times. It is being tried to be implemented in every software for various purposes, to check how it would work efficiently given different scenarios. It is a decentralized technology. It basically is data that is digital in nature and every piece ... Read More

Verification in Java (JVM)

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:27:42

743 Views

Once the byte code is loaded by the JVM, (with the help of the .class file), the bytecode is checked to see the validity with the help of the verifier. The verifier checks the linking so as to perform operations efficiently. This way, the interpreter performs much efficiently. This process ... Read More

What are C++ features missing in Java?

AmitDiwan

AmitDiwan

Updated on 17-Aug-2020 09:20:06

1K+ Views

There are many features that can be seen in C++ but not in Java. A few of them have been listed below −No unsigned int option in JavaNo destructor in Java as well as ‘delete’ since garbage collector performs this operation for it.No friend classes or friend functions in Java.There ... Read More

Advertisements