Here we are going to learn above Java Programming Language. You can watch our video on What is Java – Click Here
Q.1 What is Java?
Ans. Java is a simple and powerful high level, object oriented programming language. Java originated at Sun Microsystems, Inc. in 1991. It was developed to provide a platform-independent programming language.
Q.2 Who conceived Java?
Ans. It was conceived by James Gosling and was initially called ‘Oak’
Q.3 Why is Java called as platform Independent Language?
Ans. Java was designed with a concept of ‘write once and run everywhere’. Unlike many other programming languages including C and C++ when Java is compiled, it is not compiled into platform specific machine code, rather it is converted into platform independent byte code. This byte code is distributed over the web and interpreted by virtual Machine (JVM) on whichever platform it is being run.
Q.4 What is the difference between compiler and interpreter?
|The program that translate the source program or source code to machine language or low-level language at once is known as compiler.
|The program that translate the source program or source code to machine language or low-level language step by step or line by line is known as interpreter.
|Faster execution of control statements as compared to the interpreter.
|Slower execution of control statements as compared to the compiler.
|Detected errors in the program get displayed after the entire program is read by compiler.
|Detected errors in the program get displayed after each instruction read by the interpreter.
|Example: C++, Java.
|Example. Python, PHP.
Q.5 What are advantages of object oriented programming? / Why is Java called as Object Oriented Language?
Ans. Unlike procedural languages, in Java we can create objects, which offer many advantages:
- Objects are created on real world entities.
- Complex systems of real world can be converted into software solutions.
- Objects can be easily reused in other programs due to its re-usability feature.
- Objected oriented programs focuses the developer to do extensive planning which will reduces programming flaws and better design.
- Software maintenance of the object oriented program is easier than as compared with structured oriented programming.
Q.6 What is the difference between source code and object code?
|The set of instructions and statements written by computer programmer using a programming language to find solution of problem is known as source code or program
|The machine language program produced after the compilation of the source code is known as object code or object module or object program.
|Created by the programmer
|Created by the Compiler
Q.7 What is Byte Code?
Ans. Byte code is also called as intermediate code. Java byte code is byte long instruction set that Java compiler generates and stores in .class files. Java compiler converts Java source code into platform independent bytecode. It needs JVM to execute byte code to run.
Q. 8 What is JVM?
Ans. The java run-time system which translates or interprets byte code into machine code is known as Java Virtual Machine (JVM) or java Interpreter.
A JVM can either interpret the bytecode one instruction at a time or the bytecode can be compiled further for the real microprocessor using what is called a just-in-time compiler.
The JVM must be implemented on a particular platform before compiled programs can run on that platform.
Q. 9 What is JDK?
Ans. JDK is a kit(or package) which includes two things i) Development Tools(to provide an environment to develop your java programs) and ii) JRE (to execute your java program).
Q.10 What is full form of IDE? Give example of 2 IDE.
Ans. IDE stands for Integrated Development Environment. IDE for developing Java Application is Eclipse, NetBeans, JDeveloper, MyEclipse, BlueJ.
Q.11 What is BlueJ?
Ans. BlueJ is an integrated development environment (IDE) for the Java programming language, developed mainly for educational purposes, but also suitable for small-scale software development.
- It has a built in editor
- Interactive interface to create and test objects
- Ability to run applications
Q.12 What is the difference between Applets and application?
|It is a portable language and can be executed by any JAVA supported browser.
|Its program coding is large as compared to applets.
|It executed or runs a program on client browser.
|It can be executed on standalone computers.
|The applets are created by using java.applet.Applet package.
|The applications are created by using method:
“public static void main(String args[ ])”
Q. 13 What are comments? What are different types of comments found in the program?
- Comments are descriptions that are added to the program to make code easier to understand.
- Compiler ignores the comments
|All characters after the // up to the end of the line are ignored.
|/* comment */
|All characters between /* and */ are ignored.
|Documenting (Doc) Comment
|/** Comment */
|The JDK javadoc tool uses doc comments when preparing automatically generated documentation.
Q. 14 What are different types of errors you find in your program?
Ans. Syntax errors:
- Errors occurring when you violate a syntax rule.
- Caught during compile time
- E. g. forgetting to terminate program statement with ;
- Also called design errors or bugs which escape compilation
- Occurs when logic of the program is incorrect.
- Can be fixed by testing & debugging the program
- E. g. PI = 31.4;
- Occur when we ask the computer to do something it considers to be illegal.
- In these cases Java throws exception
- E. g. dividing by zero
Q. 15 What are Escape Sequences?
Ans. Escapes Sequences represents special control characters and characters that cannot be printed.
- They are special type of character literal
- Represented by a Backslash (\) followed by a character code
|Insert a tab in the text at this point.
|Insert a backspace in the text at this point.
|Insert a newline in the text at this point.
|Insert a carriage return in the text at this point.
|Insert a formfeed in the text at this point.
|Insert a single quote character in the text at this point.
|Insert a double quote character in the text at this point.
|Insert a backslash character in the text at this point.