Any language is characterized by two features: alphabets and grammar. To learn a language, it is necessary to learn these two features first. Once you have learned a language, you will be able to express a thought or idea, such as a poem, in the language. Language is used for communication and Java programming language is not an exception. Java language is used to express a programmer’s instructions to solve a problem just like other programming languages, for example, C, C++, Python, etc. Java looks a lot similar to C++, and, by extension, like C. If you are an experienced C or C++ programmer, this chapter is mostly redundant for you. Java enables a programmer to write robust programs. This chapter aims to teach you all the basic features of Java that a programmer should know.
Introduction
Language elements At this point, we are assuming that you have successfully installed Java and were able to run the sample programs given in Chapter 1. It is time now to start programming. As a Java programmer, it is necessary to have full understanding of the elements of the language like keywords, literals, data types, operators, loops, branches, etc.
Strongly typed language Java programming language mostly follows syntax similar to that of C/ C++ to write statements and expressions. So if you are familiar with C/ C++, it will be easy for you to understand Java. As with all modern programming languages like C/ C++, Java is a strongly typed language, which means all data to be used should be defined their types in programs. Java supports several types of data, which are called primitive data types. In this chapter we will examine several data types, their structures, operations on them, and how they can be utilized to solve problems. Constants and variables are the two basic programming elements. It is necessary to learn how the variables of different data types can be defined. Java has a very good composition of defining arrays of elements of different types, which is also an interesting concept to learn. You may use different data types to declare variables and to create arrays of elements.
Review the options below to login to check your access.
Log in with your Cambridge Aspire website account to check access.
If you believe you should have access to this content, please contact your institutional librarian or consult our FAQ page for further information about accessing our content.