November 26 2014

Protected Access Specifier In Java

Access Specifiers tell how to access the members of the class. There are four access specifiers for class members.

  1. private
  2. default
  3. protected
  4. public

Protected Access Specifier In Java

Protected members of a class can be accessible across the package and to the sub classes outside the package. It is called default + children. 

Example : In the below class, variable name and getMessage method are specified as protected. All the classes in package1 can access the class members. Continue reading

November 18 2014

Jsf selectoneradio

The h:selectOneRadio tag renders a set of HTML input element of type “radio”, and format it with HTML table and label tags.

h:selectOneRadio can be used when only one option have to be selected. This Components renders group of radion button and only option can be selected

 

Jsf Page Continue reading

Category: Jsf | LEAVE A COMMENT
November 8 2014

Java Boolean Operators

Java Boolean Operators

Boolean Operators are operators which act on boolean variables and returns the boolean result.Following are the boolean operators in java

Boolean and operator ( & )

Boolean & operator returns true only if both the variables are true otherwise returns false

Boolean or operator ( | )

Boolean | operator return true if any of the variable is true

Boolean not operator ( ! )

Boolean ! Return true if the value of the variable is false and false if value of the variable is true.

Continue reading

November 6 2014

Use of final keyword in java

Use of final keyword in java

final keyword  can be used in three ways

1.To create a constant

If a variable is declared as final ,value of the variable cannot be changed. Value must be assigned to the final variable during the declaration.


package com.answersz.corejava;

public class FinalVariableExample {

final double PI=3.1415;

public void changeFinalVariable(){
PI=2.14; // You will get the following compilation error
// The final field FinalVariableExample.PI cannot be assigned
}
}

Continue reading