Java Tutorial
IntroductionEnvironment SetupIDEBuild ManagementLanguage SpecificationBasic ProgramVariables Data TypesPackagesModifiersConditionalsLoopsObject OrientedClassesSuperInterfacesEnumStatic importInheritanceAbstractionEncapsulationPolymorphismBoxing & UnboxingConversion Formatting numbers Arrays Command line arguments in java Variable Number of arguments in Java Exception handling in Java String handling in Java StringBuffer and StringBuilder in Java Mathematical Operations in Java Date and Time in Java Regular expressions in Java Input output programming in Java File Handling Nested Classes Collections Generics Serialization Socket programming Multi-Threading Annotations Lambda Expressions Reflections in Java Singleton class in Java Runtime Class in JavaHow to load resource in JavaHow to load properties file in JavaAdvanced
Log4j – Logging framework in JavaInterview Questions in JavaIn this post, you will learn all important aspects of Java.
Key things to note about Java are –
- It’s an object oriented language.
- Everything is Class and Object in Java.
- Class, Interface and Enum names should start with Upper Case letter.
- Package names should be in lower case.
- Method names should start with lower case letter and each subsequent word should start in Capital letter – for example setMarks()
- All Java statements end with semi-colon (;).
- Single line Comments can be marked using // . For multi-line comments you need to use /* ………………*/
Keywords in Java
Here is the list of Keywords in Java.
- Data types – int, float, byte, char, double, boolean, long, short
- Access Modifiers – public, private, protected
- Object Oriented – class, Object, interface, enum, extends, implements, import, instanceof, new, native, package, super, this
- Other modifiers – static, abstract, strictfp, synchronized, transient, volatile,const, final
- Constructs – break, case, continue, default, do, else, if, for, goto, switch, while
- Exception related – catch, finally, throw, throws, try
- Others – void, false, null, true, false, assert, return
Operators in Java
Here is the list of Operators in Java.
- Arithmetic operators +, -, /, *, %, ++, —
- Logical Operators ||, &&, !
- Relational Operators <. >, ==, <=, >=, !=
- Bitwise Operators &, |, ^, ~, <<, >>
- Assignment Operators =, +=, -=, *=, /=, %=, <<=, >>=, &=, |=, ^=
- Conditional operator ?:
Operator precedence – When calculating the mathematical expressions, Java uses operator precedence rule to calculate the final value of the expression.
For example – * operator has high precedence over – operator.
x = 5-2*9
Result of above expression would be 13 and not 27. If you want to override this rule, you can use parenthesis ().
x = (5-2) * 9
Result of above expression would be 27 as everything inside parenthesis is evaluated first.
Identifiers in Java
Identifiers are nothing but the names given to variables, methods, classes, interfaces etc. Here are the rules to define the identifiers in Java.
- It should start with letter, _ or $
- It can not contain any other special character like +, &, / etc
- It should not have spaces in it
Web development and Automation testing
solutions delivered!!