

Tests condition, if condition true if block is executed else the else block is executed. return value (only if type is not void)Ĭonditional Statements in Java 1. Where type - the return type of the method name - The name of the method parameter list - sequence of type and variables separated by a comma return - statement to return value to calling routine type name (parameter list) Used to refer to the current object in a method or constructor. Used to indicate that a variable or a method is a class method.
#Smashtunes java code#
Used to execute code after the try-catch structure.

Used to catch exceptions generated by try statements. Some of the important keywords are : Keywords Static int number = 10 //static variableĪlso known as keywords, particular words are predefined in Java and cannot be used as variable or object names. Variables are created to create a single copy in the memory shared among all objects at a class level. Variables are created when an instance of the class is created and destroyed when it is destroyed. It has access only within the method in which it is declared and is destroyed later from the block or when the function call is returned. If not initialized, the default value is 0.ĭeclared using a “static” keyword. Variables are of three types in Java : Local Variableĭeclared and initialized inside the body of the method, block, or constructor.ĭeclared inside the class but outside of the method, block or constructor. It is a container that holds the value while the java program is executed. Variables are the name of the memory location. Note: Filename should be the same as the class name containing the main() method, with a. Java code can also be written in any text editor and compiled on the terminal with the following commands : $ javac. (dot operator to access methods of class)Īmongst many IDEs, the most recommended ones are : Java supports a rich set of operators that can be classified as below : Operator Category

Read here: Major features of Java programming Primitive Data Types in Java Data Type Java was modeled in its final form, keeping into consideration the primary objective of having the following features
#Smashtunes java series#
Exception Handling: Catches a series of errors or abnormality, thus eliminating any risk of crashing the system. Memory Management: Garbage collected language, i.e., deallocation of memory. The only requirement is Java needs a runtime environment, i.e., JRE, which is a set of tools used for developing Java applications. Thus, byte code is platform-independent and can run on multiple systems. This is because Java code is compiled by the compiler and converted into byte code. Platform-neutral: Java code is independent of any particular hardware or software. Open Source: Readily available for development. Object-Oriented Programming Language: based on the concepts of “objects”.

