"Programs must be written for people to read, and only incidentally for machines to execute."
Note: Below code examples are present in the Java
tutorials which have been mirrored here with direct links for convenience.
To browse through the
examples in the downloaded tutorials, you will have to start from
index.html. In it select - Trails Covering the
Basics >> Learning the Java Language >> Language
Basics.
Observe how the standard naming and coding conventions
are followed in the examples.
- ArrayDemo
-
ArithmeticDemo (Arithmetic Operators:
+, -, *, /,
%
)
- ConcatDemo
(String Concatenation)
- UnaryDemo
(Unary Operators:
+,-, ++, --,!
)
- PrePostDemo
(Prefix/Postfix Unary Increment Operatora)
- ComparisonDemo
(Example for Equality and Relational Operators: ==, !=, >, >=,
<, <= )
- Conditional1Demo
- Conditional2Demo
(Ternary Operator
(expression)?(return this if
true):(return this otherwise)
)
- InstanceofDemo
(Type Comparison Operator
instanceof
)
- BitDemo
(Bitwise
&
)
- BlockDemo
- IfElseDemo
- SwitchDemo
- SwitchDemoFallThrough
- SwitchDemo2
- WhileDemo
- DoWhileDemo
- ForDemo
- EnhancedForDemo
- BreakDemo
- BreakWithLabelDemo
- ContinueDemo
- ContinueWithLabelDemo
- Bicycle
- MountainBike
- PassPrimitiveByValue
- Point
- Rectangle
- CreateObjectDemo
- DataStructure
- Day
- EnumTest
- Planet
- Animal
- Cat
- Superclass
- Subclass
- TestFormat
- DecimalFormatDemo
- BasicMathDemo
- ExponentialDemo
- TrigonometricDemo
- StringDemo
- ValueOfDemo
- ToStringDemo
- Filename
- FilenameDemo
- RegionMatchesDemo
- StringBuilderDemo
- Box
- BoxDemo3
- CopyBytes
- CopyCharacters
- CopyLines
- ScanXan
- ScanSum
- Root
- Root2
- Format
- HelloRunnable
- HelloThread
- SleepMessages
- SimpleThreads