I would like to pass a paramter into the JVM and have my code read it. So for example on the start up script for my app server I would pass a paramter like -Dprop.dir="some/dir". How would I go about doing something like this ?
Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection. So the default connection pool using DBCP (or any other framework) is made available and the life go…
Viewers will learn about the different types of variables in Java and how to declare them.
Decide the type of variable desired:
Put the keyword corresponding to the type of variable in front of the variable name:
Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java.
Introduce the Scanner object:
Declare the variable that stores the user input:
An example prompting the user for input:
Methods you need to invoke in order to properly get user input: