1.how do you achieve synchronization at variable level ?
we can achieve synchronization at variable level by applying "VOLATILE" keyword to a variable.
Eg:
syntax for volatile declaration :
we can achieve synchronization at variable level by applying "VOLATILE" keyword to a variable.
Eg:
syntax for volatile declaration :
private volatile int testValue;
Explanation:
when we declare a variable with volatile one private variable copy will create for every thread
only that thread is allowed to modify the variable value in private copy only not in master copy,
before going to dead state of that thread it will update the variable value in master copy.
Eg prog :
package javabeat.samples;
class ExampleThread extends Thread {
private volatile int testValue;
public ExampleThread(String str){
super(str);
}
public void run() {
for (int i = 0; i < 3; i++) {
try {
System.out.println(getName() + " : "+i);
if (getName().equals("Thread 1 "))
{
testValue = 10;
}
if (getName().equals("Thread 2 "))
{
System.out.println( "Test Value : " + testValue);
}
Thread.sleep(1000);
} catch (InterruptedException exception) {
exception.printStackTrace();
}
}
}
}
public class VolatileExample {
public static void main(String args[]) {
new ExampleThread("Thread 1 ").start();
new ExampleThread("Thread 2 ").start();
}
}
2.can we have static classes ?
Yes,we can have static inner classes in java,but we can not have static outer classes.
3.what is system.out.println() ?
4.what is Association,Aggregation, and Composition ?
5.can we have private classes?
6.what is length and length() ?
7.what happend if we do not have main() method in a class ?
8.can we declare main() method as final or synchronized ?
9.what is order of modifier ?
10.what is strictfp?
11.explai native method and its advantages ?
12.explain IS-A relationship ?
13.Explain HAS-A relationship ?
14.what is automatic promotion in overloading ?
15.what is static control flow ?
16.can we print something on console with out static block and main() method ?
17.can we have instance variable inside static context ?
18.what methods are used to display error messages ?
19.Explain Try,Catch and finally ?
20.difference between finally and finalize ?
21.Examples for checked exceptions ?
22.Examples for unchecked exceptions ?
23.what is constructors ?what does it ? Explain purpose ?
24.can we have return type for constructor ?
25.what can contain default constructor ?
26.can we override constructor ?
27.how many ways a thread can be created ?
28.what are the methods can we used to prevent a thread from execution ?
29.difference betwen t.start() and t.run() ?
30.what does run method contains ?
31.can we start thread again ?
32.how do you set and get name of the threads ?
33.can we interupt a thread ?
34.what is inter thread communication ? Explain it /
35.why wait(),notify and notifyAll() in object class instead of thread class ?
36.can we call wait(),notify and notifyAll from non Static synchronized ?
37.can we change daemon thread state after starting a thread ?
38.what is coupling ?
39.what is cohesion ?
40.loosly coupled means ?
41.what are the methods available in object class ?
42.contract between hashcode and equals /
43.what is recursion ?
44.what is call by value ?
45.what is call by reffrence ?
46.how do you create a .class file in a perticular drive ?
47.how do you build a jar file ?
48.how do you extract a jar file ?
49.why string is immutable ?what does it make immutable ?
50.is string is thread safe ?
51.how many ways can string object created ?
52.explain the procee of creating string objects ?
53.advantages of SCP ?
54.how do you point a SCP object instead of heap object ?
55.what are the uses of wrapper classes ?
56.explain the Autoboxing ?
57.what is Garbage collector and explain the advantages and dis Advantages ?
58.how do you make object eligible for GarbageCollector ?
59.Between finally and finalize which is preferable ?
60.how do you enable assertions ?
61.how many types of assertions and explain ?
62.explain the types of inner classes ?
63.what is object typecasting ?
64.what is objectgraph ?
65.explain about wild card (?) character in generics ?
66.why pointers are eleminated from java ?
67.what is difference between functions and methods ?
68.which part of the jvm will allocate the memory for a java program ?
69.what are the algoriths used in Garbage collection ?
70.how many ways can we call the Garbagecollector and explain them ?
71.Explain interpretter and compiler ?
72.what does the class loader ?
73.what are the comments available in java and explain them ?
74.what is an API document and advantages ?
75.difference between #include and import ?
76.why should we write main() method ?
77.what happens if string args[] not written in main() method ?
78.what happens if main method written with out public ?
79.what happens if main method written with private ?
80.difference between print and println() ?
81.what is unicode system ?
82.what is literal ?
83.what is difference between >> and >>> ?
84.what is .(dot) operator and what does it /
85.what objects create when we say system.err and system.in ?
86.on which memory arrays are created in java ?
87.can we call main () method of a class from another class ?
88.is string class or datatype ?
89.can we call a class as a datatype ?
90.what are the benifites of object in java ?
91.relation between stack and heap ?
92.can we have constructor in interface ?
93.how many types of methods are ther in java and explain them ?
94.what is factory method explain ?
95.what are the collection views of Map ?
96.if i write system.exit(0) at the end of the try block does the finally executes ?
97.what is value() and valuesOf() ?
98.what does the command line arguements ?
99.what is the defaulting an object ?
100.what is marshaling an object ?
------------------------------
-----------------------------------------------------------------------------------------
1.what are the oops concepts ?
2.what is data hiding ?
3.what is data abstraction ?
4.what is encapsulation ?
5.what is inheritance ?
6.what is polymorphism ?
7.what is different types of polymorphisms ?
8.what is compile time polymorphism ?
9.what is Run time polymorphism ?
10.what is overloading /
11.what is overriding ?
12.what is the difference between interface and abstract class ?
13.can we have variables in interface ?
14.can we create an object for interface ?
15.can we create an object for abstract class ?
16.what ia the difference between finall,finally and finalize ?
17.what is the transient ?
18.what is volatile ?
19.what are the scope of static,instance and local variables ?
20.what are the difference among static,instance and local variables ?
21.what is Garbage collection ?
22.what is the internal process taken place while garbage collection ?
23.what are the algorithms used by the Garbage collector ?
24.can we delete the un used objects externally ?
25.what is difference between system.exit(0) and system.exit(1) ?
26.how do you difine a constant in java 1.4 and 1.5 ?
27.what is enum ?
28.what is difference between String,StringBuffer and String Builder ?
29.how many ways can we create a string objects ? explain ?
30.what is SCP ?
31.what are the features of java1.5 ?
32.difference between this and super keywords?
33.what are the methods does Object class contains ?
34.how many ways can we create object ?
35.what is cloning ?
36.what is deep and shallow cloning ?
37.what is difference between "==" and equals() ?
38.what is hashcode ? can we override hash code ?
39.what is difference between hacode and equals ?
40.can we have more than one main() method in a class ?
41.what is reflection ?
42.what is assertions ?
43.what is the difference between JDK and JVM ?
44.how many compilers are there in java ?
45.what is an exception ? explain ?
46.what is the exception hierarchy ?
47.how many types of exceptions are there ?
48.example of run time exception?
49.what is classcast exeception ?
50.what is illegalArguement exception ?
51.difference between throw and throws keywords ?
52.how do you define userdefined exceptions ?
53.throws keyword is used for compiletime or runtime exceptions ?
54.what is synchronization ?
55.what is serialization ?
56.what is externalization ?
57.what is NIO ?
58.what is deadlock ?
59.how can we prevent a deadlock ?
60.what is difference between synchronized block and method ?
61.can we have synchronized method inside the synchronized block ?
62.what is thread ?
63.what is defference between wait ,notify and sleep ?
64.what is difference between notify() and notifyAll() ?
65.what is the life cycle of a thread ?
66.what is daemon thread ?
67.what is thread priority ?
68.what are the methods available to prevent a thread ?
69.what is an anarray ?
70.what is difference between arrays and collections?
71.what is difference between ArrayList and LinkedList ?
72.what is difference between ArrayList and Vector ?
73.which is the foster collectin between ArrayList and Vector ?
74.what is stack ?
75.what is Queue ?how many types are there ? explain ?
76.what is difference between HashSet and TreeSet ?
77.what is the difference between hashMap and hashSet ?
78.what is identity hashMap ?
79.what is WeakhashMap ?
80.what is properties ?
81.what is enumeration ?
82.what are the legacy classes in java ?
83.what are the final classes in java ?
84.what is Iterator and List Iterator ?explain the difference ?
85.what is difference between comparable and comparator interface ?
86.how do you sort a list of strings in collection ?
87.what is difference between LinkedHashMap and HashMap ?
88.what is difference between HashTable and HashMap ?
89.what is defference between HashTable and treeSet ?
90.what is static import in java ?
91.how do you refer a variable which resides in SCP ?
92.what are the streams availaable in Java ?
93.what is string Tokenizer ?
94.what is difference between FileWriter and BufferedWriter ?
95.what are the advantages of PrintWriter over BufferedWriter ?
96.what are Generics ?
97.what Bound Types ?
98.what are Generic Classes ?
99.what is i18N ?
100.what is locale ?
1.what are the oops concepts ?
2.what is data hiding ?
3.what is data abstraction ?
4.what is encapsulation ?
5.what is inheritance ?
6.what is polymorphism ?
7.what is different types of polymorphisms ?
8.what is compile time polymorphism ?
9.what is Run time polymorphism ?
10.what is overloading /
11.what is overriding ?
12.what is the difference between interface and abstract class ?
13.can we have variables in interface ?
14.can we create an object for interface ?
15.can we create an object for abstract class ?
16.what ia the difference between finall,finally and finalize ?
17.what is the transient ?
18.what is volatile ?
19.what are the scope of static,instance and local variables ?
20.what are the difference among static,instance and local variables ?
21.what is Garbage collection ?
22.what is the internal process taken place while garbage collection ?
23.what are the algorithms used by the Garbage collector ?
24.can we delete the un used objects externally ?
25.what is difference between system.exit(0) and system.exit(1) ?
26.how do you difine a constant in java 1.4 and 1.5 ?
27.what is enum ?
28.what is difference between String,StringBuffer and String Builder ?
29.how many ways can we create a string objects ? explain ?
30.what is SCP ?
31.what are the features of java1.5 ?
32.difference between this and super keywords?
33.what are the methods does Object class contains ?
34.how many ways can we create object ?
35.what is cloning ?
36.what is deep and shallow cloning ?
37.what is difference between "==" and equals() ?
38.what is hashcode ? can we override hash code ?
39.what is difference between hacode and equals ?
40.can we have more than one main() method in a class ?
41.what is reflection ?
42.what is assertions ?
43.what is the difference between JDK and JVM ?
44.how many compilers are there in java ?
45.what is an exception ? explain ?
46.what is the exception hierarchy ?
47.how many types of exceptions are there ?
48.example of run time exception?
49.what is classcast exeception ?
50.what is illegalArguement exception ?
51.difference between throw and throws keywords ?
52.how do you define userdefined exceptions ?
53.throws keyword is used for compiletime or runtime exceptions ?
54.what is synchronization ?
55.what is serialization ?
56.what is externalization ?
57.what is NIO ?
58.what is deadlock ?
59.how can we prevent a deadlock ?
60.what is difference between synchronized block and method ?
61.can we have synchronized method inside the synchronized block ?
62.what is thread ?
63.what is defference between wait ,notify and sleep ?
64.what is difference between notify() and notifyAll() ?
65.what is the life cycle of a thread ?
66.what is daemon thread ?
67.what is thread priority ?
68.what are the methods available to prevent a thread ?
69.what is an anarray ?
70.what is difference between arrays and collections?
71.what is difference between ArrayList and LinkedList ?
72.what is difference between ArrayList and Vector ?
73.which is the foster collectin between ArrayList and Vector ?
74.what is stack ?
75.what is Queue ?how many types are there ? explain ?
76.what is difference between HashSet and TreeSet ?
77.what is the difference between hashMap and hashSet ?
78.what is identity hashMap ?
79.what is WeakhashMap ?
80.what is properties ?
81.what is enumeration ?
82.what are the legacy classes in java ?
83.what are the final classes in java ?
84.what is Iterator and List Iterator ?explain the difference ?
85.what is difference between comparable and comparator interface ?
86.how do you sort a list of strings in collection ?
87.what is difference between LinkedHashMap and HashMap ?
88.what is difference between HashTable and HashMap ?
89.what is defference between HashTable and treeSet ?
90.what is static import in java ?
91.how do you refer a variable which resides in SCP ?
92.what are the streams availaable in Java ?
93.what is string Tokenizer ?
94.what is difference between FileWriter and BufferedWriter ?
95.what are the advantages of PrintWriter over BufferedWriter ?
96.what are Generics ?
97.what Bound Types ?
98.what are Generic Classes ?
99.what is i18N ?
100.what is locale ?
No comments:
Post a Comment