|
Section 1: Declarations and access control
|
|
1.1 Write code that declares, constructs and initializes arrays of any base type using any of the permitted forms both for declaration and for initialization.
|
|
Section 4: Language Fundamentals
|
|
4.4 Identify all Java programming language keywords. Note: There will not be any questions regarding esoteric distinctions between keywords and manifest constants.
|
|
4.5 State the effect of using a variable or array element of any kind when no explicit assignment has been made to it.
|
|
4.6 State the range of all primitive formats, data types and declare literal values for String and all primitive types using all permitted formats bases and representations.
|
Lexical structure of any programming language is usually made up of tokens and white spaces. Some of these tokens are standard words and has special meaning in that language. The programmer is free to use the other non-standard words. A computer program is usually a mixture of these standard and non-standard tokens. One of the primary tasks of language interpreter (or compiler) is to parse these tokens. For simplifying this task, languages often declare (in their specification) which words are special and treated as standard part of language (keywords). It also tell you which words can be used by the programmer for naming variables, methods etc (identifier). In this chapter, we will learn about the keywords and identifiers in Java language. You need to learn them just like you need to know the vocabulary when you are learning a new natural language. In this chapter you will master the Java vocabulary as you will know all the Java keywords (and reserved words). You will also learn to the rules to find out whether a particular word can be used as an identifier or not.
Besides these two, you will also learn about two built-in data types in Java, primitives and arrays. Though Java is object-oriented language, everything is not an object. Object creation is usually a costly task in terms of resources. Therefore, Java does some optimization and treats basic numeric values such as integers, floating-point numbers as primitive instead of objects. Since every value has a type in Java, primitives are of primitive types. We will learn more about them in this chapter. Another interesting datatype we will learn about is the arrays. These are the special objects that are used to store a collection of values or objects.
Specifically, this chapter covers part of the fourth SCJP objective which is about some fundamental concepts in the Java language. This chapter discusses the basic components of the lexical structure of the Java language such as the identifiers, keywords and literals. You will also learn about the primitive data types and arrays. This chapter covers the 4.4, 4.5 (partially), 4.6 and 1.1 sections of SCJP objectives.