Skip to Main Content
Practical Java Programming for IoT, AI, and Blockchain
book

Practical Java Programming for IoT, AI, and Blockchain

by Perry Xiao
July 2019
Intermediate to advanced content levelIntermediate to advanced
400 pages
11h 7m
English
Wiley
Content preview from Practical Java Programming for IoT, AI, and Blockchain

CHAPTER 3Basic Java Programming

“If you think you can do a thing or think you can't do a thing, you're right.”

—Henry Ford

3.1 Introduction

This chapter introduces the basic concepts of Java programming, intended for those who have some experience in coding and familiarity with programming concepts but are new to the Java language.

3.2 Variables

Java supports eight primitive types of variables: byte, short, int, long, float, double, char, and boolean. Variable names in Java are case-sensitive and must start with a letter, an underscore, or a dollar sign ($). They cannot start with a number. After the first character, a variable name can include any combination of letters and numbers. Spaces and special symbols, such as !, "", £, %, &, *, #, @, ~, and so on, are not allowed in variable names. In Java, all variables must be declared before they can be used. To declare a variable, you will need to specify the type, leave at least one space, and then specify the variable name and a semicolon (;).

type variablename; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Introducing Blockchain with Java: Program, Implement, and Extend Blockchains with Java

Introducing Blockchain with Java: Program, Implement, and Extend Blockchains with Java

Spiro Buzharovski
Intelligent Projects Using Python

Intelligent Projects Using Python

Santanu Pattanayak, Manohar Swamynathan

Publisher Resources

ISBN: 9781119560012Purchase book