Java is a computer programming language created by Sun Microsystems. Java is used mainly on the Internet and uses a virtual machine which has been implemented in most browsers to translate Java into a specific application on different computer system. With most programming languages, you either compile or interpret a program so that you can run it on your computer. The Java programming language is unusual in that a program is both compiled and interpreted. The most common Java programs are applications and applets. Applications are standalone programs, such as the HotJava browser. Applets are similar to applications, but they don't run standalone. Instead, applets adhere to a set of conventions that lets them run within a Java-compatible browser. The Java programming language is a high-level language that can be described as, - Architecture neutral
- Object oriented
- Portable
- Distributed
- High performance
- Multithreaded
- Dynamic
- Secure
As long as a computer has a Java VM (Virtual Machine), a Java program can run on these machines,
- Windows 2000
- Linux
- Solaris
- MacOS
The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms. The Java platform has two components,
- The Java Virtual Machine (Java VM)
-compiles and translates Java scripts into Java bytecodes which can be descibed as machine code instructions.
- The Java Application Programming Interface (Java API)
- is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.
Java can offer these features,
- Objects - object-oriented technology
- strings
- threads, numbers
- input and output
- data structures
- system properties
- date and time
- Applets
- 2D and 3D graphics
- telephony
- speech
- animation
- electronic signatures
- private key management
- access control
Java FAQ
- Control Flow Statements
- The Java programming language provides several control flow statements,
- looping - while, do-while , for
- decision - making if-else, switch-case
- exception - handling try-catch-finally, throw
- branching - break, continue, label:, return
They can be used to,
- conditionally execute statements,
- to repeatedly execute a block of statements,
- and to otherwise change the normal, sequential flow of control.
(integers)
- byte - Byte-length integer - 8-bit two's complement
- short - Short integer - 16-bit two's complement
- int - Integer - 32-bit two's complement
- long - Long integer - 64-bit two's complement
(real numbers)
- float - Single-precision floating point - 32-bit IEEE 754
- double - Double-precision floating point - 64-bit IEEE 754
(other types)
- char - A single character - 16-bit Unicode character
- boolean - A boolean value (true or false) - true or false
- Expressions
- postfix operators - [] . (params) expr++ expr--
- unary operators - ++expr --expr +expr -expr ~ !
- creation or cast - new (type)expr
- multiplicative - * / %
- additive - + -
- shift - << >> >>>
- relational - < > <= >= instanceof
- equality - == !=
- bitwise AND - &
- bitwise exclusive OR - ^
- bitwise inclusive OR - |
- logical AND - &&
- logical OR - ||
- conditional - ? :
- assignment - = += -= *= /= %= &= ^= |= <<= >>= >>>=
- Numbers
- Number classes in java,
- Number
- Byte
- Double
- Float
- Integer
- Long
- Short
- BigDecimal
- BigInteger
Java Problems
- Compiler can't find a class
Solution,
- You have the correct class or its package.
- Unset the CLASSPATH environment variable, if it's set.
- Class name are case sensitive.
- Make sure you're spelling the class name exactly the same way as it is declared.
- Make sure your classes appear in the correct subdirectory.
- Make sure you're using the class name and not the filename. In fact, make the names the same and you won't run into this problem for this reason.
|