Dcit-50 Reviewer
Dcit-50 Reviewer
Dcit-50 Reviewer
HISTORY OF JAVA
*In 1991, James Gosling, Mike Sheridan, and Patrick Naughton started to create a java language
*They 1st called it “OAK”, then “GREEN”, and finally “JAVA” comes from type of coffee in Indonesia
*In 1996, Sun Microsystem released the 1st version of java the called it “JAVA 1.0.”
*JAVA 2 DIFFERENT VERSIONS – J2EE for servers, J2ME for mobiles, and J2SE for desktops
*in 2006 the sun renamed it as JAVA EE, JAVA ME, and JAVA SE
*NOV 13, 2006 Sun Microsystem release JVM as open source software
WHY JAVA IS POPULAR?(kayo na bahala mag ano sa definition nakakatamad mag type ahaha)
*SIMPLE
*OBJECT ORIENTED
*ROBUST
*SECURE
*DISTRIBUTED
*PORTABLE
*FAST
*MULTITHREADED
*DESKTOP APPLICATION
*WEB APPLICATIONS
*MOBILE
*EMBEDDED SYSTEM
*SMART CARD
*ROBOTICS
*GAMES
*STANDALONE APPLICATION
*WEB APPLICATION
*ENTERPRISE APPLICATION
*MOBILE APPLICATION
JAVA JDK – can be executed and run by the JVM and JRE
CLASS TESTCONSOLE – class declares that a new class is being defined. testconsole name of class
public static void main(String[] args) – represents the main method. Entry point of java program
public – allows the main() method to be accessed by the code outside the class
JAVA IDENTIFIERS
ARITHMETIC OPERATORS
ADDITION(+), SUBTRACTION(-), MULTIPLICATION(*), DIVISION(/), MODULUS(%), INCREMENT(++),
DECREMENT(--)
LOGICAL OPERATORS
&&LOCIAL AND, || LOGICAL OR, ! LOGICAL NOT
ASSIGNMENT OPERATORS
==, +=, -+, &=, >=, <= etc
COMPARISON OPERATORS
EQUAL TO(==), NOT EQUAL(!=), GREATER THAN(>), LESS THAN(<), GREATER THAN OR EQUAL TO(>=),
LESS THAN or EQUAL TO(<=)
SCANNER CLASS – text scanner that can parse primitive types and strings
If-else statements – execute different code blocks based on whether the condition is true or false
ELSE STATEMENT - use to specify a block of code to be executed if the condition is false
ELSE IF STATEMENT – use to specify a new condition if the first condition is false
SWITCH STATEMENT – use when have multiple options and need to different task for each option
FOR LOOP – repetition control structure that allows you to efficiently write a loop need to be executed
WHILE LOOP – repeatedly executes a target statement as long as a given condition is true
DO WHILE LOOP – similar to while loop., but the condition is evaluated after the execution of the loops
body
ARRAYS
INDEX – starts with – and ends with N-1 ibig sabihin pag may 5 elements ka ang bilang non sa index
0,1,2,3,4
METHODS
Methods – collection of statement that are gouped together to perform an operation AKA FUNCTIONS
*USER-DEFINED METHODS
ADVANTAGES OF METHODS
*Code reusability
*Reduces code duplication
*Easier debugging
*Problems are decomposed
*Hides tricky logic
*Easier to read and understand
Disadvantage of Methods
* It takes initially a little more time to set them up
VISIBILITY - The visibility of a method determines whether the method is available to other classes.
public: Allows any other class to access the method
private: Hides the method from other classes
protected: Lets subclasses use the method but hides the method from other classes
static: means that you can call it without first creating an instance of the class in which it’s defined.
return-type: After the word static comes the return type, which indicates whether the method returns a
value when it is called — and if so, what type the value is
parameter list: You can pass one or more values to a method by listing the values in parentheses
following the method name.
statements: One or more Java statements that comprise the method body, enclosed in a set of braces