Powered by Blogger.
Showing posts with label Java 5 Features. Show all posts
Showing posts with label Java 5 Features. Show all posts

What are Generics in Java

>> Saturday, March 28, 2015

In common term Generic means a common type of things or relating to a class or group of things not specific.

In Java Generics are introduced in 2004 within Java 5.0 features along with Enum, autoboxing and varargs , to provide compile time type-safety.Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods or, with a single class declaration, a set of related types, respectively.
What is type-safety?
It is just a check by compiler that correct Type(datatype) is used in correct place and there should not be any ClassCastException.

Read more..

Static Import in Java with an Example

>> Thursday, December 25, 2014

What is Static Import:
Static Import is a feature added in Java 1.5(released in Sep 30 2004 almost 10 years back!) along with Var-args,Auto-Boxing and Auto-Unboxing, Generics, Enhanced for-loop,Enums,Scanner Class and Annotations. Using this Static Import feature we can import static members of a class and as well we can access all non-private static members without using class name from other classes.

Read more..

Different type of Vararg rules in Java

>> Tuesday, November 25, 2014

While writing methods using variable arguments(var-args), we may confuse in different scenarios like where to put var-args in the parameters and how to place different type of arguments.Here we have given some rules with scenarios to understand easily. This will help you in the SCJP examination and as well, java interviews for freshers and experienced guys.
varargs rules JavabynataraJ

Read more..

Variable argument or varargs in Java

>> Thursday, November 6, 2014

The full form of var-args is variable length arguments and this one of the java 1.5 features.Also we have some important autoboxing, generics,for-each loop, static imports and some more. This feature is introduced to solve the problem in defining methods for taking '0' to 'n' number of arguments. These arguments should be of same types.  So, by using this feature we no need to define multiple overloaded methods for executing same logic with different no.of.values of same type.
java var-args explanation_JavabynataraJ

Read more..

Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.