Showing posts with label java. Show all posts
Showing posts with label java. Show all posts
Sunday, September 30, 2012
Java: Introduction to Operators, understanding Assignment and Arithmetic Operators
Java: Introduction to Operators, understanding Assignment and Arithmetic Operators
Tuesday, September 25, 2012
Autoboxing and Unboxing in Java
The Autoboxing and Unboxing was released with the Java 5.
Autoboxing
During assignment, the automatic transformation of primitive type(int, float, double etc.) into their object equivalents or wrapper type(Integer, Float, Double,etc) is known as Autoboxing.
During assignment or calling of constructor, the automatic transformation of wrapper types into their primitive equivalent is known as Unboxing. Here is a quick video that will explain you the same.
For details visit: http://www.roseindia.net/javatutorials/autoboxing_yourself_in_JDK_1_5.shtml
Conversion of int into Integer
int inactive = 0;
inactive = new Integer(5); //auto - unboxing
Integer intObject = 5; //autoboxing
int inactive = 0;
inactive = new Integer(5); //auto - unboxing
Integer intObject = 5; //autoboxing
Saturday, January 21, 2012
Java: Introduction to Strings
A string is an ordered sequence of symbols. Sting class is included in java.lang package. So each class in Java, can use String class without importing any package. The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.
Documentation:
Comparing Strings:
Exception handling in Java
An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions. When an error occurs within a method, the method creates an object and hands it off to the runtime system. The object, called an exception object, contains information about the error, including its type and the state of the program when the error occurred. Creating an exception object and handing it to the runtime system is called throwing an exception.
Subscribe to:
Posts (Atom)