Sunday, December 22, 2013

Core Java FAQs


  1. Q. what is an object?

    A.object is anything that is really exists.

  2. Q. what is a method and class?

    A.class is a blue print/ group name /collection of objects. method represents group of statements that perform a task and it is reusable component.

  3. Q. What is the difference between String and Array

    A.String it is a collection of characters. Array is a collection of elements which are same types examples are integer/float/double array ex:int[]a={10,12,3,13};

  4. Q. How to split a string

    A.By using split() method we can split the string but it returns String array. String[] str1=str.split(" ")

  5. Q. What is Overloading

    A.Writing two or more methods in a class in such a way that each method having the same name with different parameters is called Overloading

  6. Q. What is Overriding

    A.Writing two or more methods in super class and sub class such a way that each method has same name and same signatures and same return types.

  7. Q. What is Inheritance

    A.acquiring(copying) properties and methods from one class to another class.

  8. Q. How to Reverse string with out using reverse method

    A.
    String str="Nagesh";
    for (int i = str.length()-1; i >= 0; i--) {
    System.out.println(str.charAt(i));
    }

  9. Q. What is Encapsulation

    A.

No comments:

Post a Comment

TestNG - Can i use the 2 different data providers to same @test methods in TestNG?

public Object [][] dp1 () { return new Object [][] { new Object [] { "a" , "b" }, new Obje...