Raja has Published 469 Articles

How to implement a rollover effect for a JButton in Java?

raja

raja

Updated on 02-Jul-2020 07:04:18

1K+ Views

A JButton is a subclass of AbstractButton and it can be used for adding platform-independent buttons to a GUI application. A JButon can generate an ActionListener interface when the button is pressed or clicked, it can also generate the MouseListener and KeyListener interfaces. We can implement the rollover effect when the mouse moves over a ... Read More

How to read the data from a CSV file in Java?

raja

raja

Updated on 01-Jul-2020 12:10:16

24K+ Views

A CSV stands for Comma Separated Values. In a CSV file, each line contains words that are separated with a comma(, ) and it is stored with a .csv extension.We can read a CSV file line by line using the readLine() method of BufferedReader class. Split each line on comma character to get the ... Read More

Importance of the parseBoolean() method in Java?

raja

raja

Updated on 01-Jul-2020 06:13:23

172 Views

The parseBoolean() method is an important method of a Boolean class. The parseBoolean() is a static method and can parse the String method argument into a Boolean object. The parseBoolean() method of Boolean class returns the boolean represented by the string argument.Syntaxpublic static boolean parseBoolean(String s)Exampleimport java.util.Scanner; public class ParseBooleanMethodTest { ... Read More

What is the importance of a WindowListener interface in Java?

raja

raja

Updated on 30-Jun-2020 13:32:30

300 Views

The class which process the WindowEvent needs to be implemented this interface and an object of this class can be registered with a component by using addWindowListener() method.Methods of WindowListener InterfaceThe WindowListener interface defines 7 methods for handling window eventsvoid windowActivated(WindowEvent we) − Invoked when a window is activated.void windowDeactivated(WindowEvent we) − ... Read More

Can a method local inner class access the local final variables in Java?

raja

raja

Updated on 29-Jun-2020 11:12:53

829 Views

Yes, we can access the local final variables using the method local inner class because the final variables are stored on the heap and live as long as the method local inner class object may live.Method Local Inner ClassA local inner class instance can be delivered as an argument and retrieved from ... Read More

How to print pid, info, children, and destroy processes in JShell in Java 9?

raja

raja

Updated on 03-May-2020 09:53:31

158 Views

JShell is a Java Shell tool used to execute simple java statements like classes, methods, interfaces, enums,  and etc.. evaluates it, and prints the result in a command-line prompt.Java has improved Process API to manage and control operating system processes. ProcessHandle interface identifies and provides control of native processes, methods to check ... Read More

How to get system properties in JShell in Java 9?

raja

raja

Updated on 02-May-2020 11:09:29

452 Views

JShell is a REPL (Read-Evaluate-Print-Loop) tool used to execute simple statements, evaluates it, and displays the result without a main() method. We can start it by simply type "jshell" in command-line prompt.We need to get the system properties by using System.getProperty() and System.getProperties() methods.In the below code snippet, we can able ... Read More

How to implement JShell using JavaFX in Java 9?

raja

raja

Updated on 02-May-2020 09:45:07

278 Views

JShell is an interactive tool used to implement sample expressions. We can implement JShell programmatically using JavaFX application then we need to import a few packages in the java program listed belowimport jdk.jshell.JShell; import jdk.jshell.SnippetEvent; import jdk.jshell.VarSnippet;In the below example, implemented a sample Java FX application. We will enter different values in ... Read More

How to implement HashMap, LinkedHashMap, and TreeMap in JShell in Java 9?

raja

raja

Updated on 01-May-2020 17:24:58

205 Views

JShell is a command-line prompt tool introduced in Java 9, and it is also called a REPL tool to evaluate simple statements, executes it, and print the output immediately.A Map interface specifies a contract to implement collections of elements in the form of key/value pairs. Java collection classes that implement the Map interface are ... Read More

Differences between CompletableFuture and Future in Java 9?

raja

raja

Updated on 01-May-2020 11:45:14

6K+ Views

CompletableFuture class implements Future interface in Java. CompletableFuture can be used as a Future that has explicitly completed. The Future interface doesn’t provide a lot of features, we need to get the result of asynchronous computation using the get() method, which is blocked, so there is no scope to run multiple dependent tasks in ... Read More

Advertisements