0% found this document useful (0 votes)
77 views

Java Faq's

1) Java was created in 1995 by James Gosling, Arthur Van Hoff, and Andy Bechtolsheim. 2) Key features of Java include simplicity, being object oriented, platform independence, portability, being compiled and interpreted, robustness, security, being distributed, multithreaded, high performance, and architectural neutrality. 3) The main method signature describes the entry point for a Java application and includes public static void main(String args[]) to define that it is publicly accessible, a single instance, does not return anything, and accepts command line arguments.

Uploaded by

Puneet Bhutra
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Java Faq's

1) Java was created in 1995 by James Gosling, Arthur Van Hoff, and Andy Bechtolsheim. 2) Key features of Java include simplicity, being object oriented, platform independence, portability, being compiled and interpreted, robustness, security, being distributed, multithreaded, high performance, and architectural neutrality. 3) The main method signature describes the entry point for a Java application and includes public static void main(String args[]) to define that it is publicly accessible, a single instance, does not return anything, and accepts command line arguments.

Uploaded by

Puneet Bhutra
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

1) Java Developer? Ans. James Gosling, Arthur Van Hoff, Andy Bechtolsheim in 1995. 2) Features of java? Ans. i. ii.

iii. iv. v. vi. vii. viii. ix. x. xi. xii. xiii. 3) Simplicity Object Oriented Platform Independence Portable Compiled and Interpreted Robust Secure Distributed Multithreaded High performance Architectural Neutral Dynamic Extensible

Describe public static void main(String args[ ])

Ans. Public-it must accessible out of program Static-single copy of main is maintain throughout the program Void-not return anything. Args[]-every program is command line argument.(hint args[0] is 1st argument not program name as in c/c++) 4) Describe System.out.println(Hello World); Ans System- is class Out-anonymous object of output stream. Println-method to print on console

5) Steps? Ans 1)create- program save it as .java 2)compile- using javac(Justin Time Comiler) eg.javac prog.java 3)run-java(JVM interpreter)eg.java prog Tip. Generate 2 files .java and .class 6) Java Tokens? Ans Identifiers (variables) Keywords (reserved words total 60) Literals (constants 10,2.5,vijay,v all datatypes) Operators (+,-,*,/,<,!.&&,==) Separators ( { , } , ( , ) , [ , ] ) 7) Type conversion? Ans Automatic -between compatible data types -from lower size to higher size

8) Type casting? Ans (target_type) variable_name; byte b; int val = 63; b=(byte)val 9) Bytecode? Ans . Contain in .class file. Code-java compiler-bytecode Bytecodejava interpretermachine code 10) Final?

Ans 1) use to prevent inheritance(final class) 2)use to prevent method overriding(final methods) 3)declare constants(final variable) 11) This keyword? Ans. it gives reference to current object. Eg. this.var1 this.var2 12) Super keyword? Ans.use to refer immediate parent class. Eg.super.show() calls super class method Super() calls super class constructor Super.var call super class variable if public 13) Abstract class? Ans class declare with abstract keyword Cant create object(initiated) but can create instance(not initiated). Contain declares as well as defined methods Eg. void show(); declared Void display(){ } defined Useful when needed partial implementation of methods. 14) Interface ? Ans. same as class declared with interface keyword. Contain strictly final and static variables Contains only declared methods(no definition allow) Interface are implemented 15) Package? Ans. Contains classes or interfaces or may contain sub-packages or all tree. We can create packages of our own using package keyword

We can use class or interface of class by importing it. Eg. package pkg; package pkg is declared Import pkg.class1; Import pkg.*; Import java.io.*; java is main package and io is subpackage 16) Describe System.in? Ans. System-class In-anonymous object of input stream(taking input from console) 17) Exception? Ans. Exception is class located under Throwable abstract class. Runtime errors.. Throws it throws exception out of program(remove exception) Throw-it generate exception Try-block apply around the code where chances of exception. Catch-exception handling code Finally-this block executed even if exception occurs or not. 18) Error? Ans. resource missing. Thread dead. Linkage break. 19) Thread states? Ans . Newborn state start() running state or runnable state Runnable state if processor allocated running state Running state wait() or suspend() or sleep(long milliseconds) Blocked State Blocked state resume() or notify() running state or runnable state

Blocked state

stop() Dead state

20) Thread Priorities ? Ans .MIN_PRIORITY NORM_PRIORITY MAX_PRIORITY 21) Applet methods? Ans 1)init()-initialization(called once only) 2)start()-to start execution(called to start or restart applet after stop) 3)paint()-one parameter as Graphics object use to draw anything on applet. Repaint()update(Graphics g)paint(Graphics g) 4)stop()-stop applet execution temporary 5)destroy()-remove applet from memory

22) Appletviewer? Ans jdk tool-appletviewer.exe located in bin.. Provide running environment for applet without browser. 23) Apache tomcat? Ans It act as a servlet server. We synchronize our java program with tomcat and calling it from web browser(client)

24) Servlet? Ans Application that are located at web server and execute there only. Servlets are loaded into servlet container. JSP are extension to servlets.

You might also like