Content deleted Content added
Tags: Reverted Mobile edit Mobile web edit |
m Reverted edits by 5.134.159.241 (talk) to last version by Vijuloth |
||
Line 1:
{{Short description|Set of rules defining
{{see also|Java (programming language)#Syntax}}
ly structured ]. The only exception is the [[primitive types]], which are not represented by ayggv cgo o class instance for performance reasons (though can be automatically converted to objects and vice versa via [[#Boxing and ugfsw3yinboxing|autoboxing]]). Some features like [[operator overloading]] or [[unsigned integer]] types are omitted to simplify the language and to avoid possible programming mistakes.▼
{{more footnotes|date=January 2014}}
[[File:Java keywords highlighted.svg|thumb|300px|A snippet of Java code with keywords highlighted in bold blue font]]
The '''syntax of Java''' is [[syntax|the set of rules]] defining how a [[Java (programming language)|Java]] program is written and interpreted.
The Java syntax has been gradually extended in the course of numerous major [[JDK]] [[Java version history|releases]], and now sugfsdpports capabilities such as [[generic programmigxhkng]] and [[function literals]] (called lambda expressions in Java). Since 2017, a new JDK version is released twice a year, wihvfth each release bringing incremental improvements to the language.▼
▲
▲The Java syntax has been gradually extended in the course of numerous major [[JDK]] [[Java version history|releases]], and now
==Basics==
Line 20 ⟶ 26:
===Keywords===
{{Main|List of Java keywords}}
{| style="width:
|--
| abstract
| continue
|
| new
| switch
Line 30 ⟶ 36:
| assert
| default
|
| package
| synchronized
Line 37 ⟶ 43:
| do
| if
| private
| this
|-
Line 43 ⟶ 49:
| double
| implements
| protected
| throw
|-
| byte
| else
| import
| public
| throws
|-
| case
| enum
| instanceof
| return
| transient
|-
| catch
Line 62 ⟶ 70:
| try
|-
|char
|▼
|final
|interface
|static
|var
▲|-
| class
| finally
| long
| strictfp
| void
Line 89 ⟶ 100:
|-
!colspan="2"|Integers
|-
![[Binary numeral system|binary]] (introduced in Java SE
|{{mono|0b11110101}} ({{mono|0b}} followed by a binary number)
|-
![[octal]]
|{{mono|
|-
![[hexadecimal]]
|{{mono|0xF5}} ({{mono|0x}} followed by a hexadecimal number)
|-
![[decimal]]
|{{mono|
|-
!colspan="
|-
!rowspan="2" | float
|{{mono|
|-
|{{mono|0x.
|-
!rowspan="
|{{mono|23.5D}}, {{mono|.5}}, {{mono|1.
|-
|{{mono|0x.5FP0}}, {{mono|0x.5P-6D}} ({{mono|0x}} followed by a hexadecimal fraction with a mandatory exponent indicator and an optional suffix {{mono|D}})
|-
!colspan="2"|Character literals
|-
!char
|{{mono|'a'}}, {{
|-
!colspan="2"|Boolean literals
|-
!boolean
|{{mono|true}
|-
!colspan="
|-
!null reference
|{{mono|
|-
!colspan="2"|String literals
Line 143 ⟶ 160:
|-
![[Form feed]]
|{{mono|\
|-
![[
|{{mono|\\}}
|-
![[Single
|{{mono|\'}}
|-
![[Double quote]]
|{{mono|\
|-
![[Tab character|Tab]]
Line 161 ⟶ 178:
|}
Integer literals are of <code>int</code> type by default unless <code>long</code> type is specified by appending <code>
===Variables===
|