Cool Programming Facts (JAVA)
1. Assembly language
uses a short descriptive word, known as a mnemonic, to represent each of the machine-language instructions. For example, the mnemonic add typically means to add numbers and the sub means to subtract numbers.
To add the numbers 2 and 3 and get the result, you might write an instruction in assembly code like this: assembly language
add 2, 3, result
Assembly languages were developed to make programming easier. However, because the computer cannot execute assembly language, another program—called an assembler is used to translate assembly-language programs into machine code.
2. Java Editions
Java is a full-fledged and powerful language that can be used in many ways. It comes in three editions: Java SE, EE, and ME
■ Java Standard Edition (Java SE) to develop client-side applications. The applications can run standalone or as applets running from a Web browser.
■ Java Enterprise Edition (Java EE) to develop server-side applications, such as Java servlets, JavaServer Pages (JSP), and JavaServer Faces (JSF).
■ Java Micro Edition (Java ME) to develop applications for mobile devices, such as cell phones.
3. Java uses both Compiler and Interpreter
To execute a Java program is to run the program’s bytecode. And to generate byte code source code has to be compiled first. After that, you can execute the bytecode on any platform with a JVM, which is an interpreter. It translates the individual instructions in the bytecode into the target machine language code one at a time rather than the whole program as a single unit. Each step is executed immediately after it is translated.
4. Classloader and Bytecode Verifier
When executing a Java program, the JVM first loads the bytecode of the class to memory using a program called the class loader. If your program uses other classes, the classloader dynamically loads them just before they are needed. After a class is loaded, the JVM uses a program called the bytecode verifier to check the validity of the bytecode and to ensure that the bytecode does not violate Java’s security restrictions. Java enforces strict security to make sure that Java class files are not tampered with and do no harm to your computer
5. JavaDoc: commenting techqnique- HTML in java...
In addition to line comments (beginning with // ) and block comments (beginning with / ), Java supports comments of a special type, referred to as Javadoc comments. Javadoc comments begin with /** and end with /. They can be extracted into an HTML file using the JDK’s Javadoc command. For more information, see Supplement III.Y, Javadoc Comments, on the companion Website. Use Javadoc comments ( /* ... / ) for commenting on an entire class or an entire method. These comments must precede the class or the method header in order to be extracted into a Javadoc HTML file. For commenting on steps inside a method, use line comments ( // ).
6. Specific import and Wildcard import
There are two types of import statements: specific import and wildcard import. The specific import specifies a single class in the import statement. For example, the following statement importsScanner from the package java. util.
import java.util.Scanner;
The wildcard import imports all the classes in a package by using the asterisk as the wildcard. For example, the following statement imports all the classes from the package java. util.
import java.util.*;