Gender: : Male
Branch: : Electronics Engineering
City : Delhi
CORE JAVA QUESTIONSQ1.What will be the result of compiling and running the given program?
public class Q1 {
public static void main(String[] args) {
boolean t1 = true, t2 = false, t3 = t1;
boolean t = false;
t &&= (t1 || ( t2 && t3)); //line no. 5
System.out.println("boolean t = "+t);
}
}
1. Compile time error at the line no. 5 as illegal start of expression as well as this is not a statement
2. Program compiles correctly and print "boolean t = false" when executed.
3. Compile time error at the line no. 7.
4. Program compiles correctly and print "boolean t = true" when executed.
Similar Threads:
FaaDoO Moderator!
Gender: : Male
Branch: : Electronics Engineering
City : Delhi
fulljava Questions
1.The Java interpreter is used for the execution of the source code.
True
False
Ans: a.
2) On successful compilation a file with the class extension is created.
a) True
b) False
Ans: a.
3) The Java source code can be created in a Notepad editor.
a) True
b) False
Ans: a.
...............
FaaDoO Moderator!
Gender: : Male
Branch: : Electronics Engineering
City : Delhi
Java interview questions
Question What is the difference between an Applet and an Application? (Applets)
Answer
The differences between an applet and an application are as follows:
1. Applets can be embedded in HTML pages and downloaded over the Internet whereas
Applications have no special support in HTML for embedding or downloading.
2. Applets can only be executed inside a java compatible container, such as a browser or appletviewer whereas Applications are executed at command line by java.exe or jview.exe.
3. Applets execute under strict security limitations that disallow certain operations
(sandbox model security) whereas Applications have no inherent security restrictions.
4. Applets don't have the main() method as in applications. Instead they operate on an entirely different mechanism where they are initialized by init(),started by start(),stopped by stop() or destroyed by destroy().
FaaDoO Moderator!
Gender: : Male
Branch: : Electronics Engineering
City : Delhi
Java Interview Questions
Question Can an Interface be final? (CoreJava)
Answer No
Question Can an Interface have an inner class? (CoreJava)
Answer Yes public interface abc { static int i=0; void dd(); class a1 { a1() { int j; System.out.println("in interfia"); }; public static void main(String a1[]) { System.out.println("in interfia"); } } }
FaaDoO Moderator!