Day 2: Basic opps consept

Why is Java Secure? Java is considered a secure programming language because of several built-in security features: Bytecode Verification – Java programs are compiled into bytecode, which is checked by the JVM before execution to prevent malicious code. Memory Management – Java has automatic garbage collection, which prevents memory leaks and unauthorized memory access. Sandboxing – Java programs run in a restricted environment (sandbox), preventing access to critical system resources. No Explicit Pointers – Unlike C/C++, Java does not use pointers, reducing the risk of memory corruption and unauthorized access. ClassLoader Mechanism – Prevents loading untrusted classes from unknown sources. Security Manager & APIs – Java provides a Security Manager to restrict file access, network access, and system operations. Encryption & Authentication – Java provides strong cryptography APIs (e.g., Java Security API, Java Cryptography Extension). class $ A class is simply a representation of a type of object. It is the blueprint, plan, or template that describes the details of an object. object An object is an instance of a class. It has its own state, behavior, and identity. What is OOPS? OOPS is abbreviated as Object-Oriented Programming System, in which programs are considered as a collection of objects. Each object is nothing but an instance of a class. Write basic concepts of OOPS? The basic concepts of OOPS are: Abstraction Encapsulation Inheritance Polymorphism Encapsulation Encapsulation is an attribute of an object that contains all hidden data. The hidden data can only be accessed by the members of that class. Levels of access control: $ Public $ Protected $ Private $ Internal $ Protected Internal Polymorphism $ Polymorphism means "many forms". It allows a method or function to behave differently based on the object that calls it. Example: A single function name can have different implementations in different classes (method overriding) or can accept different parameters (method overloading). Inheritance Inheritance is a concept where one class shares the structure and behavior defined in another class. Abstraction Abstraction is the process of hiding the implementation details from the user and showing only the essential features of an object.

Mar 25, 2025 - 18:21
 0
Day 2: Basic opps consept

Why is Java Secure?

Java is considered a secure programming language because of several built-in security features:

  1. Bytecode Verification – Java programs are compiled into bytecode, which is checked by the JVM before execution to prevent malicious code.

  2. Memory Management – Java has automatic garbage collection, which prevents memory leaks and unauthorized memory access.

  3. Sandboxing – Java programs run in a restricted environment (sandbox), preventing access to critical system resources.

  4. No Explicit Pointers – Unlike C/C++, Java does not use pointers, reducing the risk of memory corruption and unauthorized access.

  5. ClassLoader Mechanism – Prevents loading untrusted classes from unknown sources.

  6. Security Manager & APIs – Java provides a Security Manager to restrict file access, network access, and system operations.

  7. Encryption & Authentication – Java provides strong cryptography APIs (e.g., Java Security API, Java Cryptography Extension).

class

$ A class is simply a representation of a type of object. It is the blueprint, plan, or template that describes the details of an object.

object

An object is an instance of a class. It has its own state, behavior, and identity.

What is OOPS?

OOPS is abbreviated as Object-Oriented Programming System, in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.

Write basic concepts of OOPS?

The basic concepts of OOPS are:

  1. Abstraction

  2. Encapsulation

  3. Inheritance

  4. Polymorphism

Encapsulation

Encapsulation is an attribute of an object that contains all hidden data. The hidden data can only be accessed by the members of that class.

Image description

Levels of access control:

$ Public

$ Protected

$ Private

$ Internal

$ Protected Internal

Polymorphism

$ Polymorphism means "many forms". It allows a method or function to behave differently based on the object that calls it.

Image description

Example: A single function name can have different implementations in different classes (method overriding) or can accept different parameters (method overloading).

Inheritance

Inheritance is a concept where one class shares the structure and behavior defined in another class.

Abstraction

Abstraction is the process of hiding the implementation details from the user and showing only the essential features of an object.