IT PF Reviewer Merged
IT PF Reviewer Merged
IT PF Reviewer Merged
Lesson 1:
Approach
- In OOPs concept of objects and classes is introduced and hence
and the program is divided into small chunks called objects
which are instances of classes.
- On the other hand in case of POP the main program is divided
into small part based on the functions and is treated as separate
program for individual smaller program.
Security
- Due to abstraction in OOPs data hiding is possible and hence it
is more secure than POP.
- On other hand POP is less secure as compare to OOPs
Complexity
- Oops due to modularity in its programs is less complex and
hence new data objects can be created easily from existing
objects making object oriented programs easy to modify.
- On other hand there’s no simple process to add data in POP at
least not without revising the whole program.
Java
- Java – was first introduced By Sun Microsystems and was further
acquired by Oracle in 1995.
- It’s first name was Oak.
- It was Immediately collaborated with Netscape Navigator’s Java
Virtual Machine (JVM).
- Java adapted the syntax of C++.
- It Promised Write Once, Run Anywhere (WORA), providing no cost
run times on popular platforms.
Example of Class,
Object, Attributes,
and Methods:
Lesson 2
Java Programming Life Cycle
For PC users;
- Linux/Windows/Mac Operating System
- Java JDK 6 or higher versions
- Any text editor
Lesson 3
Case Sensitivity
Java is case sensitive, which means identifier HelloWorld and
helloWorld would have different meaning.
Naming Convention
Class names – For all class names, firs letter should be in Upper Case, If
several words are used to form a name of the class, each inner words are
used to form a name of the class, each inner word’s first letter should be in
Upper Case. Example class MyFirstJavaClass.
Method Names - All method names should start with a Lower Case
Letter.
Constant Names – All constant names should be in written in Upper
Case. If several words are used to form the name of the constant, then put
underscore between words.
Variable Name - should be start in lower Case and then Capitalize the
first letter of every subsequent word.
Program File Name
Name of the program file should exactly match the class name. When
saving the file, you should save it using the class name (Remember Java is
case sensitive) and add ‘.java’ to the end of the name.
Main Method
public static void main(String args []) { - Java Program processing starts
from the main() method, which is a mandatory part of every Java
application.
Java Identifiers
All identifiers should begin with a letter (A to Z or a to z), currency
character ($) or an underscore (_).
A class name should start from a capital case letter and long names
should use camel casing. For example: TaxationDepartment
Object name should start from lower case letter and long names
should use camel casing. For example: taxationDepartment
Java Modifiers
Java Variables
1. Local variables
2. Class Variables (Static Variables)
3. Instance Variables (Non-static variables)
Java Arrays
Arrays – are object that store multiple variables of the same type.
However, an array itself is an object. We will look into how to declare,
construct and initialize in the upcoming chapters.
The following list shows the reserved words in Java. These reserved words
may not be used as constant or variable or any other identifier names.
Escape Sequence in Java
// This is a comment.
System.out.println(“Hello World”);
System.out.println(“Hello World”);
Class Header
Main Method
Blocks
Constant
Variables
- Are data who can hold only one value at a time, but the value it holds can change.
Data type
- An item’s data type describes the type of data can be stored in it, how much memory the
item occupies and what types of operations can be performed on the data.
Data Type:
2. Reference classes,arrays, strings etc.., which stores references data than the actual data.
Declaring Variables
- A variables is a statement that reserves a named memory location and includes the
following:
Data Type
Identifier
Optional assignment operator and assigned value
Semicolon
ex.., int myAge;
Declaring constants
The data types bytes, short, long, are variation of integer data types.
Depicts comma
Ex..,
Operator:
Performing Arithmetic
Operator
-Subtraction /Division
String types
- Data at String types can hold values such as series of characters, words, sentence etc…,
Arithmetic Operations
- Refers to the rules for the order in which parts of a mathematical expressions are
evaluated.
Operators:
/ * % Higher
+- Lower
Associativity
Operator Precedence
Type conversion
- Process of converting one data type to another
Data type
Unifying Type
- Is the type to which all operands in expression are converted so that they are
compatible with each other.
Double highest
Float
Int lowest
Explicit Conversion
- Purposely overriding the unifying type imposed by java by performing a type cast
Type Casting
- Forces a value of one data type to be used as a value of another type
Ex..,
float myMoney = 47.82f;
dollars = 47
Accepting Input from user (KB)
- To create interactive programs that accept input from a user, you can use System.in
which refers to the standard input device. (keyboard)
In the library;
import java.util.Scanner;
in the block;
nextInt(); nextLong();
nextShort();
nextByte();
Methods
- The operation for a class is called methods; it is used to set the valued if the data,
retrieve the current values of the data, and perform other class- related functions on the
data
- A method is a program module that contains a series of statements that carry out a task
Method Calls and Placement
- To execute a method, you invoke or call it. In other words, a calling method makes
a method call, and the method call invokes a called method. The calling method is
also known as a client method because a called method provides a service for its
client
displayAddress();
Method Construction ;
Access Specifiers
Return Type
Method Name
Parenthesis
- Data items you use in call to a method are called arguments. When the method
receives the data items, they are called parameters. Method that receives data are
flexible because they can produce different results depending on what data they receive.