Concept

What are the basic syntax rules of Java?

ComputerScienceOne / Basic Syntax Rules

"Using the Hello World! program as a starting point, we will now examine the basic elements of the Java language. Java’s syntax is adopted from C, referred to as “C-style syntax.” These elements include the following.\n\n• Java is a statically typed language so variables must be declared along with their types before using them.\n\n• Strings are delimited with double quotes. Single characters, including special escaped characters are delimited by single quotes; \"this is a string\", and these are characters: 'A', '4', '$' and '\n\n'\n\n• In addition, Java uses Unicode (UTF-16 encoding) to represent characters. This is fully back-compatible with ASCII, but also allows you to specify Unicode characters using special escape sequences and hexadecimal encodings. For example, '\\u4FFA' represents a Japanese character: The string \"\\u4FFA\\u306F\\u6700\\u9AD8\\u3060\\u305C\\uFF01\" represents the phrase\n\n• Executable statements are terminated by a semicolon, ;\n\n• Code blocks are defined using opening and closing curly brackets, { ... }. Moreover, code blocks can be nested: code blocks can be defined within other code"

Related Ideas