Java Tips and Tricks

Should You Get Java and JavaScript Off Your Computer? by Kelly Lynn

  Computer security columns evangelize how important it is for people to disable JavaScript on their computers. They tell you that your computer’s security is seriously compromised if you keep JavaScript on your computer. Is this true? JavaScript makes much of the modern Web experience possible. Is the security threat serious enough that you should hobble your Internet experience to this degree? What exactly does JavaScript do? JavaScript is the programming language that makes webpages come alive. It is used to program nearly every web browser. Many people confuse JavaScript with Java – a plug-in that you need to install separately. Java, the plug-in, is created and maintained by a separate company called Oracle that often seems to not care about good security practices. Major industry experts recommend that everyone … Continue reading

Interacting With the User Through Java by Kelly Lynn

  While there is plenty you can do with Java through non-interactive code, sooner or later you will encounter a problem that needs user input. There are three basic ways to do this. 1. Direct Typing This is the simplest way. It allows the user to input variables of classes such as boolean, string, long, int, and double without creating an input box. In Eclipse, the text is typed into the console screen. Here’s an example: import java.util.Scanner; public class InputTest { public static void main(String[] args){ Scanner inputScanner = new Scanner(System. in ); System. out .print( "What is your name? " ); String name = inputScanner.next(); System. out .print( "What year is it? " ); int year = inputScanner.nextInt(); }} The result would look like this: What is your … Continue reading