Ans: JVM is platform dependent.Every OS e.g Macintosh, windows or Linux etc. has different JVMs.Java compiller converts the java source file into .class file which is nothing but Byte code or intermediate code which is understood by JVM.Now, JVM converts the byte code into machine code which is platform specific. Hence,JVM is platform dependent.
Q. Is java pure or fully object oriented programing language?
Ans: No, java is not fully object oriented programing language because it supports Primitive data types such as int, byte, long... etc,which are not objects.Smalltalk is a pure OOP language where there are no primitive data types, and boolean, int ... etc are all objects.
Q. Can you execute java application without using main() method ?
Ans: • Yes, (using static block) before java 7
• No, from java 7.
Q. What is keywords in java?How many keywords are there in java?
Ans: Keywords are the reserved words in java language that have a predefined meaning.Keywords cannot be used as names for variables, methods, classes, or as any other identifier.There are total 50 keywords in java. Example: abstract, assert,break,case,catch,class,const,continue,default,do,double,else,enum,extends, final,finally,float,for etc.
Q. what is identifier in java?
Ans:Any name in java is called an identfier in java.It may be a method name,class name,variable name etc.
The allowed characters in identifier are :
1. Alphabets a to z both upper and lower case.
2.Digits 0-9
3.$ and _
e.g- Customer_name, _$Car,_Car etc..
If we are using other then these we will get a compillation error.
Identifier cannot start with digits.
e.g- 123total // compillation error
java identifiers are case sensitive.
e.g- student and Student are different.
Reserved words cannot be used as identifiers.
All predefined java class name and interface name we can use as identifier but not recommendable.
e.g- class TestIdentifier
{
int String=25; // OK
System.out.println(String);
}
No comments:
Post a Comment