JAVA CODE SNIPPET-7

JAVA CODE SNIPPET-7
/**
 * 
 */
package techyield;

/**
 * @author satyanarayana gokavarapu
 *
 */
public class Super {
 void init( long a,long b)
 {
  System.out.println("Super class long,long method.");
 }
 void init( Long a,Long b)
 {
  System.out.println("Super class Long,Long method.");
 }
}
package techyield;
/**
 * @author satyanarayana gokavarapu
 *
 */
public class Test extends Super{

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Super object = new Test();
  object.init(2,3);
 }
 void init( int a,int b)
 {
  System.out.println("Test class int,int method.");
 }
 void init(int... a)
 {
  System.out.println("Test class varargs method.");
 }
 void init( long a,long b)
 {
  System.out.println("Test class long,long method.");
 }
}

Select an answer





Please comment below if you have any doubts.

JAVA CODE SNIPPET-10

Java Code Snippet-10
/**
 * 
 */
package techyield;

/**
 * @author satyanarayana gokavarapu
 *
 */
public class Node {

 public Node(int i) {
  System.out.println("In Node class parameterized constructor "+i);
 }

}
package techyield;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author satyanarayana gokavarapu
 *
 */
public class Test{

 public static void main(String[] args) {
  // TODO Auto-generated method stub

  List list = new ArrayList();
  list.add(new Node(10));
  list.add(new String("Krishna"));
  System.out.println(list.get(1)); 

  Set set = new HashSet();
  set.add(new Node(1));
  set.add(new Node(2));
  set.add(new Node(2));
  System.out.println("Length of set is "+set.size());
 }


}

Select an answer





Please comment below if you have any doubts.

JAVA CODE SNIPPET-9

JAVA CODE SNIPPET-9
package techyield;
/**
 * @author satyanarayana gokavarapu
 *
 */
public class Test{

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Test object = new Test();
  int value=4;
  object.init(value,value);
 }
 void init( Long a,Long b)
 {
  System.out.println("Test class Long,Long method.");
 }
 void init(int... a)
 {
  System.out.println("Test class varargs method.");
 }
}

Select an answer





Please comment below if you have any doubts.

JAVA CODE SNIPPET-8

JAVA CODE SNIPPET-8
package techyield;
/**
 * @author satyanarayana gokavarapu
 *
 */
public class Test{

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Test object = new Test();
  int value=4;
  object.init(value,value);
 }
 void init( Long a,Long b)
 {
  System.out.println("Test class Long,Long method.");
 }
 void init(int... a)
 {
  System.out.println("Test class varargs method.");
 }
 void init( long a,long b)
 {
  System.out.println("Test class long,long method.");
 }
}

Select an answer





Please comment below if you have any doubts.

JAVA CODE SNIPPET-6

Java Code Snippet-6
/**
 * 
 */
package techyield;

/**
 * @author satyanarayana gokavarapu
 *
 */
public class Super {
 void init( long a,long b)
 {
  System.out.println("Super class long,long method.");
 }
 void init( Long a,Long b)
 {
  System.out.println("Super class Long,Long method.");
 }
}
package techyield;
/**
 * @author satyanarayana gokavarapu
 *
 */
public class Test extends Super{

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Super object = new Test();
  object.init(2,3);
 }
 void init( int a,int b)
 {
  System.out.println("Test class int,int method.");
 }
 void init(int... a)
 {
  System.out.println("Test class varargs method.");
 }
}

Select an answer





Please comment below if you have any doubts.

JAVA CODE SNIPPET-5

Java Code Snippet-5
/**
 * 
 */
package techyield;

/**
 * @author satyanarayana gokavarapu
 *
 */
public class Super {
 void init( int a,int b)
 {
  System.out.println("Super class int,int method.");
 }
 void init( long a,long b)
 {
  System.out.println("Super class long,long method.");
 }
 void init( Long a,Long b)
 {
  System.out.println("Super class Long,Long method.");
 }
}
package techyield;
/**
 * @author satyanarayana gokavarapu
 *
 */
public class Test extends Super{

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Test object = new Test();
  object.init(2,3);
 }
 void init(int... a)
 {
  System.out.println("Test class varargs method.");
 }
}

Select an answer





Please comment below if you have any doubts.

JAVA CODE SNIPPET-4

Java Code Snippet-4
/**
 * 
 */
package techyield;

/**
 * @author satyanarayana gokavarapu
 *
 */
public class Super {
 void init(final long a,long b)
 {
  System.out.println("Super class long method.");
 }

}
package techyield;
/**
 * @author satyanarayana gokavarapu
 *
 */
public class Test extends Super{

 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Test object = new Test();
  object.init(2,3);
 }
 void init(int... a)
 {
  System.out.println("Test class varargs method.");
 }
}

Select an answer





Please comment below if you have any doubts.

Featured Post

H1B Visa Stamping at US Consulate

  H1B Visa Stamping at US Consulate If you are outside of the US, you need to apply for US Visa at a US Consulate or a US Embassy and get H1...