Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Javascript
Description: Full notes of java is present in these pdf. With easy topics and fast to understand

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Java script
For students

Introduction

Java is a programming language that can be used to create applications for many devices and
platforms
...


What is Java used for?

Creating mobile and web apps
Creating enterprise software
Creating Internet of Things (IoT) devices
Creating gaming applications
Creating big data applications
Creating cloud-based applications

What are the Java platforms?

Java Platform, Standard Edition (Java SE): A core platform of Java
Java Platform, Enterprise Edition (Java EE): A platform built on top of Java SE that’s used to
develop web and enterprise applications
Java Platform, Micro Edition (Java ME): A platform of Java
Java FX: A platform of Java

What are the Java development tools?

Java Development Kit (JDK): A software development environment that contains tools and libraries
for developing Java applications
Java Runtime Environment (JRE): A software package that contains the Java Virtual Machine
(JVM) and Java class libraries
Eclipse: An IDE for managing the Java language
NetBeans: An IDE that can be downloaded with the JDK

Setting up a Java environment

Setting up a Java environment” means downloading and installing the Java Development Kit (JDK)
on your computer, then configuring system environment variables like “JAVA_HOME” to point to
the installation directory, allowing your system to locate and execute Java programs properly;
essentially making your computer ready to run Java applications by defining the necessary paths
and settings
...

Installation:
Running the downloaded installer and following the on-screen instructions to install the JDK on
your computer
...

PATH: Adding the path to the “bin” directory within the JDK installation to your system PATH
variable, enabling you to run Java commands directly from the command line
...
The JVM interprets the bytecode and translates it into machine code that the
computer can understand
...

Execute: The JVM interprets the bytecode and translates it into machine code
...


Portable
Java programs can run on any system with a JVM, regardless of the operating system or hardware
...

Optimized
The compiler uses techniques like constant folding and peephole optimization to improve
performance
...
You can think of it as a box with a
label on it
...

Data Types: Data types define the kind of value a variable can hold
...
g
...
14)
...
g
...

Boolean: Represents a logical value, either true or false
...

Undefined: Represents a variable that has been declared but not assigned a value
...

Array : Represents an ordered collection of values
...


Declaring Variables:
You can declare variables using the following keywords:
var: The traditional way of declaring variables
...

Let: Introduced in ES6
...

Const: Introduced in ES6
...

Example
Let name = “John”; // String
let age = 25; // Number
let isStudent = true; // Boolean
let city; // Undefined

Get user input in JavaScript
To get user input in JavaScript, you can use the prompt() function
...
The user can enter their
input in the input field
...
In this example, we store the
input in the name variable
...
In this example, we use the alert()
function to display a greeting message that includes the user’s name
...

How to run it:
Create an HTML file: Create a new file with
...
g
...
html)
...
html file in your web browser
...


Java data type
Java has two main categories of data types:
1
...

Byte: 8-bit signed integer (-128 to 127)
short: 16-bit signed integer (-32,768 to 32,767)
int: 32-bit signed integer (-2,147,483,648 to 2,147,483,647)
long: 64-bit signed integer (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
float: 32-bit floating-point number
double: 64-bit floating-point number
char: 16-bit Unicode character
boolean: Represents true or false values

Data type

Reference Data Types: These are used to refer to objects
...

Arrays : Used to store collections of elements of the same type
...

Interfaces: Define a set of methods that a class must important

Example
Public class DataTypesExample {
public static void main(String[] args) {
int age = 25;
double salary = 55000
...
out
...
out
...
out
...
out
...
out
...

Syntax:
If (condition) {
// code to execute if the condition is true
} else {
// code to execute if the condition is false
}

Example

Int age = 18;
if (age >= 18) {
System
...
println(“You are eligible to vote
...
out
...
”);
}

Explanation

The if keyword is followed by a condition in parentheses
...

If the condition evaluates to false, the code block within the second set of curly braces (following
the else keyword) is executed
...
You can have an if statement without an else block
...

You can nest if-else statements within each other for more complex logic
...
equals() method:
Checks if two strings have the same content
...

Case-sensitive
...
out
...
equals(str2)); // Output: false

Equalslgnore case
2
...

Returns true if the strings are equal (ignoring case), false otherwise
...
out
...
equalsIgnoreCase(str2)); // Output: true

3
...

Returns:
0 if the strings are equal
...

A positive value if the first string is lexicographically greater than the second string
...
out
...
compareTo(str2)); // Output: a negative value (Apple comes before Banana)

4
...
compareToIgnoreCase() method:
Same as compareTo(), but ignores case differences
...
out
...
compareToIgnoreCase(str2)); // Output: a negative value (Apple comes before
banana, ignoring case)

5
...
== operator:
Checks if two string references point to the same object in memory
...

Example
String str1 = “Hello”;
String str2 = “Hello”;
String str3 = new String(“Hello”);
System
...
println(str1 == str2); // Output: true (both refer to the same literal)
System
...
println(str1 == str3); // Output: false (different objects in memory)

Choosing the Right Method:

For simple equality checks, use equals() or equalsIgnoreCase()
...

For lexicographical comparisons, use compareTo() or compareToIgnoreCase()
...


Else if
In Java, else if and nested if statements are used to handle multiple conditions
...
else if:
Used to check multiple conditions in sequence
...

Only one block of code associated with the first true condition is executed
...
out
...
out
...
out
...
out
...
Nested if:
Used to check a condition within another condition
...

Program
Int age = 20;
boolean isStudent = true;
if (age >= 18) {
if (isStudent) {
System
...
println(“Eligible for student discount”);
} else {
System
...
println(“Eligible for regular discount”);
}
} else {
System
...
println(“Not eligible for any discount”);
}

Key Differences:

Else if is used for sequential checks, whereas nested if is used for hierarchical checks
...


Ternary operation

In Java, the ternary operator is a concise way to write an if-else statement in a single line
...

Expression1: The value returned if the condition is true
...


Example

Int x = 10;
String result = (x > 5) ? “x is greater than 5” : “x is less than or equal to 5”;
System
...
println(result); // Output: x is greater than 5

For loop
In Java, a for loop is a control flow statement that allows you to execute a block of code repeatedly for
a specified number of times
...
It is typically used to initialize a
loop control variable
...
If it evaluates to true, the loop body
is executed
...

Increment:
This expression is executed after each iteration of the loop
...


Example

For (int i = 0; i < 5; i++) {
System
...
println(“Hello, World!”);
}
This code will print “Hello, World!” five times
...
It is used to iterate over a range of values or to repeat a
code block a specific number of times
...
g
...

Infinite for loop:
This type of loop runs indefinitely until it is explicitly terminated using a break statement
...

It’s like a container that holds a specific number of values, all of which must be of the same data
type (e
...
, integers, doubles, strings, objects)
...

Homogeneous Elements: All elements in an array must be of the same data type
...

Object: An array is an object in Java, so it has properties and methods that can be used to
manipulate the array
...
length; // length will be 5

Nested for loop
A nested for loop in Java is a loop inside another loop
...

Example:
public class NestedLoopExample {
public static void main(String[] args) {
// Outer loop
for (int i = 1; i <= 3; i++) {
System
...
println(“Outer Loop: “ + i);
// Inner loop
for (int j = 1; j <= 2; j++) {
System
...
println(“ Inner Loop: “ + j);
}
}
}
}

Output
Outer Loop: 1
Inner Loop: 1
Inner Loop: 2
Outer Loop: 2
Inner Loop: 1
Inner Loop: 2
Outer Loop: 3
Inner Loop: 1
Inner Loop: 2

Explanation

The outer loop runs 3 times (i = 1, 2, 3)
...

The inner loop prints “Inner Loop” along with the current value of j
...


While loop

A while loop in Java repeatedly executes a block of code as long as a given condition remains true
...
out
...
The loop continues to execute as long as the i variable is
less than 5
...

Update:
Make sure to update the variable(s) used in the condition within the loop body, otherwise, you
might end up with an infinite loop
...

Syntex
Do {
// code block to be executed
} while (condition);

How it works and key points
How it works:
The code block within the do brackets is executed first, regardless of the condition
...

If the condition is true, the code block is executed again
...

Key Point:
The do-while loop guarantees that the code block will execute at least once, even if the condition is
initially false
...


Example
Int i = 0;
do {
System
...
println(“Value of i: “ + i);
i++;
} while (i < 5);
Output
Value of i: 0
Value of i: 1
Value of i: 2
Value of i: 3
Value of i: 4

Classes and objects
In Java, classes and objects are fundamental building blocks of object-oriented programming (OOP)
...

It defines the structure and behavior of objects, including their:
Attributes: Variables that store data associated with an object
...

Object:
An object is an instance of a class
...

Each object has its own unique set of attribute values, but they all share the same methods defined in the class

Function in java
In Java, a function is typically referred to as a method
...
addNumbers(5, 3);
System
...
println(“Result: “ + result); // Output: Result: 8
}
}

Components of a Method:

Access Modifier: public, private, protected, or default (no modifier)
...
g
...

Method Name: A meaningful name to identify the method (e
...
, addNumbers)
...
g
...

Method Body: The code that performs the method’s functionality
...
Unlike some languages, Java doesn’t have standalone functions
...
It’s the entry point for your program’s execution
...

Java 8 introduced functional interfaces and lambda expressions, which provide a more concise
way to work with functions
...
*/) {
// code to be executed
}

Explanation
Function keyword:
This keyword is used to declare a function
...
It should be descriptive and follow JavaScript naming conventions
...
These parameters act as placeholders
for values that will be passed to the function when it is called
...
:
These are the names of the parameters
...

`{} Curly Braces:
Inside the curly braces, you write the code that will be executed when the function is called
...


Example
Function greet(name) {
console
...

It takes one parameter, name
...


Return keyword
In Python, the return keyword is used to exit a function and return a value back to the caller
...

Value Return:
The return statement can optionally include a value that the function should return
...

Default Return Value:
If a function doesn’t have a return statement, or if the return statement is used without a value, the
function returns None by default
...

It adds these two numbers and returns the result using the return statement
...

Finally, the result is printed, which is 8
...
The compiler determines which method to call based on the
number, types, and order of the arguments passed during the method invocation
...
out
...
add(2, 3));

// Output: 5

System
...
println (calc
...
5, 3
...
0
System
...
println (calc
...

Return Type:
Method overloading can have the same or different return types, but the parameter list must differ
...
g
...

Compile-Time Polymorphism:
Method overloading is a form of compile-time polymorphism, where the compiler determines which
method to execute based on the method signature
...

Key points about constructors:
Name: The constructor has the same name as the class it belongs to
...

Purpose: It is used to initialize the object’s state by assigning values to its member variables
...

Overloading: You can create multiple constructors with different parameters, allowing you to
initialize objects in different ways
...
name = name;
this
...
out
...
name); // Output: John
System
...
println(person
...
It’s
used for developing Java applications, Android apps, and other web projects
...
org
Select the installation folder
Click Install
Launch Eclipse

Inheritance
Inheritance in Java is a mechanism that allows one class (the subclass or child class) to inherit the properties and behaviors
(fields and methods) of another class (the superclass or parent class)
...

Hierarchical Structure:
Inheritance allows you to create a hierarchy of classes, modeling real-world relationships (e
...
, a Car is a type of Vehicle)
...

Access Modifiers:
The access modifiers (e
...
, public, protected, private) play a crucial role in determining which members of the superclass are
accessible to the subclass
...
out
...
out
...
eat (); // Inherited from Animal
dog
...
Single Inheritance:
A class inherits from only one parent class
...

Class Animal {
void eat() {
System
...
println(“Animal is eating”);
}
}
class Dog extends Animal {
void bark() {
System
...
println(“Dog is barking”);
}
}

2
...
Multilevel Inheritance:
A class inherits from a parent class, which in turn inherits from another parent class, forming a chain
...
out
...
out
...
out
...
Hierarchical Inheritance:
Class Animal {
void eat() {
System
...
println(“Animal is eating”);
}
}
class Dog extends Animal {
void bark() {
System
...
println(“Dog is barking”);
}
}
class Cat extends Animal {
void meow() {
System
...
println(“Cat is meowing”);
}
}

4
...

However, a class can implement multiple interfaces, achieving a form of multiple inheritance
...
out
...
out
...
Hybrid Inheritance:

5
...

Achieved by combining single, multilevel, hierarchical, and/or interface inheritance

Lambda expression

A lambda expression in Java is a concise way to represent a functional interface (an interface with
a single abstract method)
...

Syntax:
(parameter list) -> { body }

Example
// Traditional way to create a Runnable
Runnable runnable = new Runnable() {
@Override
public void run() {
System
...
println(“Hello, world!”);
}
};
// Using a lambda expression
Runnable runnable = () -> System
...
println(“Hello, world!”);

Key words
Parameter List:
The list of parameters that the lambda expression accepts
...

Arrow Token:
The -> separates the parameter list from the body of the lambda expression
...
It can be a single expression or a block of code
enclosed in curly braces {}
...

Common Use Cases:
Iterating over collections
List names = Arrays
...
forEach(name -> System
...
println(name));

Filtering collections
...
asList(1, 2, 3, 4, 5);
List evenNumbers = numbers
...
filter(n -> n % 2 == 0)

...
toList());

Sorting collections
...
asList(“Alice”, “Bob”, “Charlie”);
names
...
compareTo(name2));

Implementing functional interfaces
...
compare(x, y);

Thread in java

In Java, a thread is a lightweight process that allows you to perform multiple tasks concurrently
within a single program
...

class MyThread extends Thread {
public void run() {
// Code to be executed in the thread
}
}
public class Main {
public static void main(String[] args) {
MyThread thread = new MyThread();
thread
...
start(); // Starts the thread
}
}

Thread Life Cycle:

New: A thread is in the new state when it is created but not yet started
...

Running: A thread is running when it is currently executing
...

Terminated: A thread is terminated when it has finished executing
...


Important Methods:

Start(): Starts the thread
...

Sleep(): Pauses the thread for a specified period of time
...

Interrupt(): Interrupts the thread’s execution
...

Efficient resource utilization:
Threads can utilize CPU resources more efficiently by allowing multiple tasks to execute
concurrently
...



Title: Javascript
Description: Full notes of java is present in these pdf. With easy topics and fast to understand