Sunday, July 9, 2023

Wrapper Classes-INTRODUCTION

 Wrapper Classes

A Wrapper class in Java is a class whose object wraps or contains primitive data types. When we create an object to a wrapper class, it contains a field and in this field, we can store primitive data types. In other words, we can wrap a primitive value into a wrapper class object. Let’s check on the wrapper classes in Java with examples:


Need of Wrapper Classes

There are certain needs for using the Wrapper class in Java as mentioned below:


They convert primitive data types into objects. Objects are needed if we wish to modify the arguments passed into a method (because primitive types are passed by value).

The classes in java.util package handles only objects and hence wrapper classes help in this case also.

Data structures in the Collection framework, such as ArrayList and Vector, store only objects (reference types) and not primitive types.

An object is needed to support synchronization in multithreading.

Advantages of Wrapper Classes

Collections allowed only object data.

On object data we can call multiple methods compareTo(), equals(), toString()

Cloning process only objects

Object data allowed null values.

Serialization can allow only object data.





REF:https://www.geeksforgeeks.org/wrapper-classes-java/

WRAPPER CLASS-INTEGER

 Constructors: 

1.public Integer(int b)

2.public Integer(String s) throws NumberFormatException


Methods: 

1. toString() : Returns the string corresponding to the int value. 

2.toHexString() : Returns the string corresponding to the int value in hexadecimal form, that is it returns a string representing the int value in hex characters-[0-9][a-f] 

3.toOctalString() : Returns the string corresponding to the int value in octal form, that is it returns a string representing the int value in octal characters-[0-7] 

4. toBinaryString() : Returns the string corresponding to the int value in binary digits, that is it returns a string representing the int value in hex characters-[0/1] 

5.valueOf() : returns the Integer object initialised with the value provided. 

6.valueOf(String val,int radix): Another overloaded function which provides function similar to new Integer(Integer.parseInteger(val,radix))

7.parseInt() : returns int value by parsing the string in radix provided. Differs from valueOf() as it returns a primitive int value and valueOf() return Integer object. 

8.rotateLeft() : Returns a primitive int by rotating the bits left by given distance in two’s complement form of the value given. When rotating left, the most significant bit is moved to the right-hand side, or least significant position i.e. cyclic movement of bits takes place. Negative distance signifies right rotation.

9.rotateRight() : Returns a primitive int by rotating the bits right by given distance in the twos complement form of the value given. When rotating right, the least significant bit is moved to the left hand side, or most significant position i.e. cyclic movement of bits takes place. Negative distance signifies left rotation. 

10.bitcount() : Returns number of set bits in twos complement of the integer given. 

11. numberOfTrailingZeroes() : Returns number of 0 bits following the last 1 bit in twos complement form of the value, i.e. if the number in twos complement form is 0000 1010 0000 0000, then this function would return 9. 

12.equals() : Used to compare the equality of two Integer objects. This method returns true if both the objects contain the same int value. Should be used only if checking for equality. In all other cases, the compareTo method should be preferred. 

13.compareTo() : Used to compare two Integer objects for numerical equality. This should be used when comparing two Integer values for numerical equality as it would differentiate between less and greater values. Returns a value less than 0,0, a value greater than 0 for less than, equal to and greater than. 

14.static int max(int a, int b): This method returns the greater of two int values as if by calling Math.max.

15.static int min(int a, int b): This method returns the smaller of two int values as if by calling Math.min.

16.static int sum(int a, int b): This method adds two integers together as per the + operator.

17.

WRAPPER CLASS-AUTOBOX UNBOX

 wrapper class:

Primitive Type Wrapper class

boolean                    Boolean

char                    Character

byte                            Byte

short                    Short

int                            Integer

long                            Long

float                    Float

double                    Double



Autoboxing

The automatic conversion of primitive data type into its corresponding wrapper class is known as autoboxing, for example, byte to Byte, char to Character, int to Integer, long to Long, float to Float, boolean to Boolean, double to Double, and short to Short.


class BoxingExample1{  

  public static void main(String args[]){  

    int a=50;  

        Integer a2=new Integer(a);//Boxing    

        Integer a3=5;//Boxing            

        System.out.println(a2+" "+a3);  

 }   

}  

The automatic conversion of wrapper class type into corresponding primitive type, is known as Unboxing.

Unboxing

class UnboxingExample1{  

  public static void main(String args[]){  

    Integer i=new Integer(50);  

        int a=i;            

        System.out.println(a);  

 }   

}  


Tuesday, March 7, 2023

Tuesday, January 24, 2023

Cloud computing QUESTION SET

 Cloud computing QUESTION SET 1-CLICK

 Cloud computing QUESTION SET 2- CLICK

 Cloud computing QUESTION SET 3- CLICK

 Cloud computing QUESTION SET 4-CLICK

 Cloud computing QUESTION SET 5- CLICK

 Cloud computing QUESTION SET 6- CLICK

 Cloud computing QUESTION SET 7-

CASE STUDIE - CLOUD

 Aneka

CometCloud

Autonomic cloud bridging

GOOGLE APP ENGINE

                      Google App Engine integrates the following tools:

                     1. Python runtime. 

                     2. Java runtime.

                    3. Software Development Kit (SDK): Enables developers to write application code. 

                    4. Web-based Administration Console: Helps developers manage their applications. 

                    5. A Datastore: A software layer that stores a web application’s data. 


AMAZON WEB SERVICES (AWS)


EUCALYPTUS

MS Azure,Azure Cache

Cloud computing QUESTION SET 5

 The Cloud Security Alliance

ELEMENTS OF CLOUD SECURITY MODEL

The Cloud Cube Model

Security Aspects

Platform-as-a-Service Security Issues

Infrastructure-as-a-Service Security Issues

Software-as-a-Service Security Issues

Disaster Recovery

BENEFITS OF TRUSTED CLOUD

CLOUD DATA ENCRYPTION

CLOUD DATA ENCRYPTION

SIX SURFACE ATTACKS


Cloud computing QUESTION SET 4

 Cloud Architecture

several approaches of cloud migration.

pay-as-you-go paradigm

server consolidation

Software-as-a-Service Security Issues

Cloud computing QUESTION SET 3

 Cloud Computing Model:

The NIST cloud computing model

On-demand self-service:

Resource pooling:

Public Cloud,Private Cloud,Community Cloud,Hybrid Cloud


■ Infrastructure-as-a-Service (IaaS)

 ■ Platform-as-a-Service (PaaS)

 ■ Software-as-a-Service (SaaS)


Security Management-as-a-Service

Identity Management-as-a-Service (IDaaS)

Storage-as-a-Service

Database-as-a-Service

Backup-as-a-Service (BaaS)


OPEN CLOUD SERVICES

5-4-3 Principles of Cloud computing