Thursday, January 19, 2017

InterView_Gyan_of_2nd_day

Q1.what is output of this code
public class Assign1 
{
 public static void main(String d[])
 {
 for(int i = 1; i <= 50; i++)
 {
 if(i % (3*5) == 0)
 System.out.println("dil");
 else if(i % 5 == 0)
 System.out.println("pagal");
 else if(i % 3 == 0)
 System.out.println("hai");
 else System.out.println(i);
 }
 }
 }
Q2.how many way access private data member in another class except reflection and getter()and setter()?
Q3.how many way to convert string except using toString()?
Q4.what are different between shallow clonning and deep clonning with example?
Q5.what are main advantage of serialization explain with example?
Q6.How not to serialize any field in class?
Q7.When child class is serialized does parent class get serialized?
Q8.When parent is serialized does child class get serialized?
Q9.How to avoid child class from getting serialized?
Q10.Some system-level classes such as Thread, OutputStream and its subclasses, and Socket are not serializable. ?

1 comment: