Content deleted Content added
Z. Patterson (talk | contribs) m The article has American English spellings. Do not use contractions. |
Z. Patterson (talk | contribs) Rescuing 6 sources and tagging 0 as dead.) #IABot (v2.0.9.5 |
||
Line 423:
! 2
| style="border-bottom-style: none" | <code>++</code> <code>--</code>
| style="border-bottom-style: none" | Postfix increment and decrement<ref>{{Cite web|title = Operators (The Java™ Tutorials > Learning the Java Language > Language Basics)|url = http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html|website = docs.oracle.com|access-date = June 16, 2015|publisher = Oracle and/or its affiliates|archive-date = June 24, 2015|archive-url = https://web.archive.org/web/20150624161036/http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html|url-status = live}}</ref>
|-
! rowspan=5| 3
Line 556:
====<code>switch</code> statement====
[[Switch statement]]s in Java can use <code>byte</code>, <code>short</code>, <code>char</code>, and <code>int</code> (not <code>long</code>) primitive data types or their corresponding wrapper types. Starting with J2SE 5.0, it is possible to use [[Enumerated type|enum types]]. Starting with Java SE 7, it is possible to use Strings.<ref>{{Cite web|title=The switch Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)|url=https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html|access-date=August 15, 2021|website=docs.oracle.com|archive-date=March 15, 2010|archive-url=https://web.archive.org/web/20100315060844/http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html|url-status=live}}</ref> Other [[reference type]]s cannot be used in <code>switch</code> statements.
Possible values are listed using <code>case</code> labels. These labels in Java may contain only constants (including enum constants and string constants). Execution will start after the label corresponding to the expression inside the brackets. An optional <code>default</code> label may be present to declare that the code following it will be executed if none of the case labels correspond to the expression.
Line 864:
==Primitive types==
Primitive types in Java include integer types, floating-point numbers, [[UTF-16]] code units and a Boolean type. There are no unsigned types in Java except <code>char</code> type, which is used to represent UTF-16 code units. The lack of unsigned types is offset by introducing unsigned right shift operation (<code>>>></code>), which is not present in C++. Nevertheless, criticisms have been leveled about the lack of compatibility with C and C++ this causes.<ref>{{cite web|url=http://darksleep.com/player/JavaAndUnsignedTypes.html|first=Sean|last=Owens|title=Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof)|access-date=April 21, 2010|archive-date=February 20, 2009|archive-url=https://web.archive.org/web/20090220171410/http://darksleep.com/player/JavaAndUnsignedTypes.html|url-status=live}}</ref> <!-- This is a terrible citation. If you have a better one, use it. -->
{| class="wikitable"
Line 1,500:
</syntaxhighlight>
Lambda's parameters types do not have to be fully specified and can be inferred from the interface it implements. Lambda's body can be written without a body block and a <code>return</code> statement if it is only an expression. Also, for those interfaces which only have a single parameter in the method, round brackets can be omitted.<ref>{{Cite web|title=Lambda Expressions (The Java™ Tutorials > Learning the Java Language > Classes and Objects)|url=https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html|access-date=August 8, 2021|website=docs.oracle.com|archive-date=June 16, 2020|archive-url=https://web.archive.org/web/20200616055353/https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html|url-status=live}}</ref>
<syntaxhighlight lang="java">
Line 1,663:
{{Main|Generics in Java}}
[[Generic programming|Generics]], or parameterized types, or [[parametric polymorphism]], is one of the major features introduced in [[J2SE 5.0]]. Before generics were introduced, it was required to declare all the types explicitly. With generics, it became possible to work in a similar manner with different types without declaring the exact types. The main purpose of generics is to ensure type safety and to detect runtime errors during compilation. Unlike C#, information on the used parameters is not available at runtime due to [[type erasure]].<ref>
===Generic classes===
Line 1,766:
{{Refbegin}}
* {{cite book |last1=Naughton |first1=Patrick |author1-link=Patrick Naughton |last2=Schildt |first2=Herbert |author2-link=Herbert Schildt |year=1999 |title=Java 2: The Complete Reference |edition=3rd |publisher=The McGraw-Hill Companies |isbn=0-07-211976-4}}
* {{cite book |last1=Vermeulen |last2=Ambler |last3=Bumgardner |last4=Metz |last5=Misfeldt |last6=Shur |last7=Thompson |year=2000 |title=The Elements of Java Style |url-access=registration |url=https://archive.org/details/elementsofjavast00verm |publisher=Cambridge University Press |isbn=0-521-77768-2 }}
* {{cite book |last1=Gosling |first1=James |author1-link=James Gosling |last2=Joy |first2=Bill |author2-link=Bill Joy |last3=Steele |first3=Guy |author3-link=Guy L. Steele Jr. |last4=Bracha |first4=Gilad |year=2005 |title=Java Language Specification |edition=3rd |url=http://java.sun.com/docs/books/jls/ |publisher=Addison-Wesley Professional |access-date=December 3, 2008 |archive-date=February 26, 2009 |archive-url=https://web.archive.org/web/20090226152425/http://java.sun.com/docs/books/jls/ |url-status=live }}
{{Refend}}
|