|
Section
4 : Language Fundamentals
State the correspondence between
index values in the argument array passed to a main
method and command line arguments. Identify all Java
Programming Language keywords and correctly
constructed identifiers.
Command line arguments and the main () method :
Whatever
arguments are passed as command line arguments while
executing a Java program are placed in the String []
array parameter of the main method. When there are no
arguments, the String array is an empty array. If you
pass a single argument, it is placed at the array
index 0. So, args[0] corresponds to this argument.
Thus the number of arguments becomes the length of the
array and the arguments are accessed in the program in
the usual way of accessing elements of an array.
Java
keywords :
|
abstract |
double |
int |
strictfp |
|
boolean |
else |
interface |
super |
|
break |
extends |
long |
switch |
|
byte |
final |
native |
synchronized |
|
case |
finally |
new |
this |
|
catch |
float |
package |
throw |
|
char |
for |
private |
throws |
|
class |
goto |
protected |
transient |
|
const |
if |
public |
try |
|
continue |
implements |
return |
void |
|
default |
import |
short |
volatile |
|
do |
instanceOf |
static |
while |
Apart from these 48
keywords, there are three more words : null,
true and false. Many authors list these
words as keywords too. But, Java Language
Specification says that these are not keywords but
literals.
section4-1 | section4-2 | section4-3 | section4-4
Sections :
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
|