In: Computer Science
In JAVA
A. A Java applet is a stand-alone program that does not require a web browser. True or False
B.Which of the following are valid identifiers in java? (will the identifier compile?)
C.What is the decimal (base 10) equivalent of 162 in octal?
D.Which of these identifiers obey the naming convention for object names?
A) False
Explanation: Java applet is a java program but can not directly run on a standalone machine.To run a applet we need a web browser which is java enabled.Hence we require a web browser and it is not stand alone.
-------------------------------------------------------
B)
Rules for identifiers in Java.
1) Identifiers contain only alphanumeric characters [a-z][A-Z][0-9], Dollar($) and underscore ( _ )
2) It should not start with numbers.
3) It should not be a reserved word in Java.
The above valid identifiers are valid because they hold the above mentions rules.
If the identifiers are invalid , they dont get complied,(we get an error).
--------------------------------------------------
C)
Given to find decimal equivalent of (162)8
= 64 + 48 + 2=114.
Answer 114.
----------------------------------------------------------
D)Naming convention for objec names:
4.If the name contains more than one word, start with a lower case letter of first word and next word should start with upper case. Example: functionName
Isthisokay - Does not obey . As this is starting with uppercase letter .
Correct Convention- isThisOkay
goodName - Obey. As this is starting with lower case letter and next word is started with upper case letter.
C3PO - Does not Obey .As starting with upper case letter.
ThisIsReallyOkay - Does not Obey. As starting with upper case letter.
Correct convention: thisIsReallyOkay
areallygreatname - Does not Obey. As the first letter of next word is not upper case.
Correct convention: aReallyGreatName
anotherBadOne - Obey. As this is starting with lower case letter and next word is started with upper case letter.