Thursday 16 June 2016

Do You Have Questions ??




if you have any technical question regarding :
JAVA - core and advance ,java FX , mvc, spring , hibernate ,sql , jquery .
You can save your serach time here .
Feel free to ask 

Click here to ask Question .

Sunday 8 May 2016

You can Compare Boolean Arrays


say you have :

  boolean[] blnArray1 = new boolean[]{true,false,true};


  boolean[] blnArray2 = new boolean[]{true,false,true};


 boolean blnResult = Arrays.equals(blnArray1,blnArray2);


Note :  It returns true if both arrays are equal. Arrays are considered as equal. if they contain same                   elements in same order.

                 System.out.println("Are two boolean arrays equal ? : " + blnResult);


Note :  Two boolean array references pointing to null are considered as equal.

Wednesday 4 May 2016

Static methods can be generic

  1. class Test {
  2.   static <T> T identity(T t) {
  3. return t;
  4. }
  5. public static void main(String[] args) {
  6. String s = Test.<String> identity("Hi");
  7. System.out.print(s);
  8. }
  9. }

Named loops:


  1. outer:
  2. for (i = 0; i < arr.length; i++) {
  3. for (j = 0; j < arr[i].length; j++) {
  4. if (someCondition(i, j)) {
  5. break outer;
  6. }
  7. }
  8. }

UtcDate -JAVA


public static  Date getUtcDate(Date date) {
   
SimpleDateFormat sdf = new SimpleDateFormat(TIMESTAMP);

sdf.setTimeZone(TimeZone.getTimeZone("UTC"));

Date utcDate = new Date(sdf.format(date));

return utcDate;

}