Dcit-50 Reviewer

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

INTRODUCTION TO JAVA –

*java is a “PROGRAMMING LANGUAGE” released by “SUN MICROSYSTEM in 1995”

*java is developed by “JAMES GOSLING”

*compiled to a “BYTECODE” which is run by “JAVA VIRTUAL MACHINE(JVM)”

*Java is related to “JAVASCRIPT”

(kung pano na eexecute ang program sa java)


JAVA PROGRAM(source code) – JAVA COMPILER – JAVA BYTECODE --- JAVA BYTECODE – JAVA INTERPRETER – MACHINCE CODE

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

*ORACLE took over Sun Microsystem in 2009-10

*APRIL 2, 2010 – JAMES GOSLING LEFT THE ORACLE

WHY USE JAVA?

*Java works in different platforms(WINDOWS, MAC, LINUX, RASPBERRY PI, etc)

*Most popular programming language

*easy to learn and use

*secure, fast, and powerful

*has huge community support(10millions of developers)

WHY JAVA IS POPULAR?(kayo na bahala mag ano sa definition nakakatamad mag type ahaha)

*SIMPLE

*OBJECT ORIENTED
*ROBUST

*SECURE

*DISTRIBUTED

*PORTABLE

*FAST

*MULTITHREADED

JAVA APPLICATIONS(JAVA CURRENTLY USED IN)

*DESKTOP APPLICATION

*WEB APPLICATIONS

*ENTERPRISE APPLICATION LIKE BANKING APPLICATION

*MOBILE

*EMBEDDED SYSTEM

*SMART CARD

*ROBOTICS

*GAMES

TYPES OF JAVA APPLICATION

*STANDALONE APPLICATION

*WEB APPLICATION

*ENTERPRISE APPLICATION

*MOBILE APPLICATION

JAVA JDK – can be executed and run by the JVM and JRE

JVM – Component that executes programs

JRE – part of java that creates JVM

BASIC STRUCTURE OF JAVA

PACKAGE – use to croup related class


IMPORT – used to import built-in and user defined packages

CLASS TESTCONSOLE – class declares that a new class is being defined. testconsole name of class

{} CURLY BRACES – the entire class definition

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

static – allows main() to be called without instance of the class

main() – method called when a java application begins

String[] args – an array of instances of the class

System.out.println – display the string in the screen

JAVA IDENTIFIERS

*names given to a variable, class or method

*have no maximum length

*first character must be a letter

PRIMITIVE DATA TYPE


Byte, short, int, long, float, double, Boolean, char

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

BUFFEREDREADER CLASS – used to read text from character streams

SELECTION AND ITERATION STATEMENTS

If-else statements – execute different code blocks based on whether the condition is true or false

IF STATEMENT – use to specify a block of java code to be executed if a condition is true

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

NESTED IF ELSE – present inside the body of another IF or ELSE

SWITCH STATEMENT – use when have multiple options and need to different task for each option

ITERATION STATEMENT – these statements create loops.

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

Arrays – use to store multiple values in a single variable

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

MULTIDIMENSIONAL ARRAY – array containing one or more arrays

METHODS

Methods – collection of statement that are gouped together to perform an operation AKA FUNCTIONS

TYPES OF JAVA METHODS

*STANDARD LIBRARY METHOD

*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

You might also like