0% found this document useful (0 votes)
18 views

Installation of Java

The document provides a detailed guide on installing Java and the Android Framework, including steps for downloading and configuring Android Studio. It also outlines the components of the Android SDK, such as SDK Tools, Build Tools, Emulator, and Platform-tools, along with their functionalities. Additionally, it explains Java concepts like method overriding, constructor overloading, and the structure of Java classes with examples.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Installation of Java

The document provides a detailed guide on installing Java and the Android Framework, including steps for downloading and configuring Android Studio. It also outlines the components of the Android SDK, such as SDK Tools, Build Tools, Emulator, and Platform-tools, along with their functionalities. Additionally, it explains Java concepts like method overriding, constructor overloading, and the structure of Java classes with examples.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

1.Installation of Java, android Framework?

Step 1: Head over to this link to get the Android Studio executable or zip file.
Step 2: Click on the Download Android Studio Button.

Click on the “I have read and agree with the above terms and conditions” checkbox
followed by the download button.
Click on the Save file button in the appeared prompt box and the file will start
downloading.
Step 3: After the downloading has finished, open the file from downloads and run
it. It will prompt the following dialog box.
Click on next. In the next prompt, it’ll ask for a path for installation. Choose a path
and hit next.
Step 4: It will start the installation, and once it is completed, it will be like the image
shown below.

Click on next.
Step 5: Once “Finish” is clicked, it will ask whether the previous settings need to be
imported [if the android studio had been installed earlier], or not. It is better to choose
the ‘Don’t import Settings option’.

Click the OK button.


Step 6: This will start the Android Studio.
Meanwhile, it will be finding the available SDK components.

Step 7: After it has found the SDK components, it will redirect to the Welcome dialog
box.

Click on Next.
Choose Standard and click on Next. Now choose the theme, whether
the Light theme or the Dark one. The light one is called the IntelliJ theme whereas
the dark theme is called Dracula. Choose as required.
Click on the Next button.
Step 8: Now it is time to download the SDK components.
Click on Finish. Components begin to download let it complete.
The Android Studio has been successfully configured. Now it’s time to launch and
build apps. Click on the Finish button to launch it.
Step 9: Click on Start a new Android Studio project to build a new app.
2.Android SDK Manager and its all components?
1. Android SDK Tools
Android SDK tool is an important component of Android SDK. It consists of a
complete set of development and debugging tools. Below are the SDK
developer tools:
 Android SDK Build tool.
 Android Emulator.
 Android SDK Platform-tools.
 Android SDK Tools.
These are shown below :
2. Android SDK Build-Tools
Android SDK build tools are used for building actual binaries of Android App.
The main functions of Android SDK Build tools are built, debug, run and test Android
applications. The latest version of the Android SDK Build tool is 30.0.3. While
downloading or updating Android in our System, one must ensure that its latest
version is download in SDK Components.
3. Android Emulator
An Android Emulator is a device that simulates an Android device on your
system. Suppose we want to run our android application that we code. One option is
that we will run this on our Android Mobile by Enabling USB Debugging on our
mobile. Another option is using Android Emulator. In Android Emulator the virtual
android device is shown on our system on which we run the Android application that
we code.

Thus, it simply means that without needing any physical device Android SDK
component “Android Emulator” provides a virtual device on the System where we
run our Application. The emulator’s come with the configuration for Various android
phones, tablets, Wear OS, and Android TV devices.

In Android Virtual Emulator all functions that are feasible on real Android
mobile is works on virtual Device like:
 phone calls, text messages.
 stimulate different network speeds.
 specify the location of a device
 access on google play store and lot’s more.
But there is one disadvantage of this emulator is that. It is very slow when
System’s PC has less RAM. It works fine when a maximum GB of RAM is present
on our device.
4. Android SDK Platform-tools
Android SDK Platform-tools is helpful when we are working on Project and
they will show the error messages at the same time. It is specifically used for
testing. It includes:
 Android Debug Bridge (ADB), is a command-line tool that helps to
communicate with the device. It allows us to perform an action such as Installing
App and Debugging App etc.
 Fastboot allows you to flash a device with a new system image.
 Systrace tools help to collect and inspect timing information. It is very
crucial for App Debugging.
5. Android SDK Tools
Android SDK tool is a component of SDK tool. It consists of a set of tools
which and other Utilities which are crucial for the development of Android
Application. It contains the complete set of Debugging and Development tools for
android.
6. SDK Platforms
For Each Android Software, one SDK platform is available as shown below:
Like in this Android 11.0(R) is installed.
These are numbered according to the android version. The new version of
the SDK platform has more features and more compatible but the old version is less
compatible with fewer features. Like in Android 11.0(R) have more compatible and
have more feature but the below versions like Android 10.0(Q), Android4.4(KitKat)
have less feature and is less compatible.
7. SDK Update Sites
In SDK Update Sites, some sites are embedded in it which will check for
Android SDK Updates Tools. In this, one must ensure we don’t unclick the button
below because these are checked by default which will check for updates if we will
unclick it then it doesn’t check updates for those.
3.Programs based on the overriding,
constructor, classes in Java?
Ans: In Java, Overriding is a feature that allows a subclass or child class
to provide a specific implementation of a method that is already provided by
one of its super-classes or parent classes. When a method in a subclass has
the same name, the same parameters or signature, and the same return
type(or sub-type) as a method in its super-class, then the method in the
subclass is said to override the method in the super-class.
Method overriding is one of the ways by which Java achieves Run Time
Polymorphism. The version of a method that is executed will be determined
by the object that is used to invoke it. If an object of a parent class is used to
invoke the method, then the version in the parent class will be executed, but
if an object of the subclass is used to invoke the method, then the version in
the child class will be executed. In other words, it is the type of the object
being referred to (not the type of the reference variable) that determines
which version of an overridden method will be executed.
Example of Method Overriding in Java
Below is the implementation of the Java Method Overriding:
Java

// Java program to demonstrate

// method overriding in java

// Base Class

class Parent {

void show() { System.out.println("Parent's show()"); }

// Inherited class

class Child extends Parent {

// This method overrides show() of Parent

@Override void show()

System.out.println("Child's show()");

}
}

// Driver class

class Main {

public static void main(String[] args)

// If a Parent type reference refers

// to a Parent object, then Parent's

// show is called

Parent obj1 = new Parent();

obj1.show();

// If a Parent type reference refers

// to a Child object Child's show()

// is called. This is called RUN TIME

// POLYMORPHISM.

Parent obj2 = new Child();

obj2.show();

Output
Parent's show()
Child's show()

 Constructor Overloading?
Sometimes there is a need of initializing an object in different ways. This can
be done using constructor overloading.
For example, the Thread class has 8 types of constructors. If we do not want
to specify anything about a thread then we can simply use the default
constructor of the Thread class, however, if we need to specify the thread
name, then we may call the parameterized constructor of the Thread class
with a String args like this:
Thread t= new Thread (" MyThread ");
Let us take an example to understand the need of constructor overloading.
Consider the following implementation of a class Box with only one
constructor taking three arguments.
// An example class to understand need of
// constructor overloading.
class Box
{
double width, height,depth;

// constructor used when all dimensions


// specified
Box(double w, double h, double d)
{
width = w;
height = h;
depth = d;
}

// compute and return volume


double volume()
{
return width * height * depth;
}
}
As we can see that the Box() constructor requires three parameters. This
means that all declarations of Box objects must pass three arguments to the
Box() constructor.
For example, the following statement is currently invalid:
Box ob = new Box();
Since Box() requires three arguments, it’s an error to call it without them.
Suppose we simply wanted a box object without initial dimension, or want to
initialize a cube by specifying only one value that would be used for all three
dimensions. From the above implementation of the Box class, these options
are not available to us. These types of problems of different ways of
initializing an object can be solved by constructor overloading.

Example of Constructor Overloading

Below is the improved version of class Box with constructor overloading.

 Java

// Java program to illustrate

// Constructor Overloading

class Box {

double width, height, depth;

// constructor used when all dimensions

// specified

Box(double w, double h, double d)

width = w;
height = h;

depth = d;

// constructor used when no dimensions

// specified

Box() { width = height = depth = 0; }

// constructor used when cube is created

Box(double len) { width = height = depth = len; }

// compute and return volume

double volume() { return width * height * depth; }

// Driver code

public class Test {

public static void main(String args[])

// create boxes using the various


// constructors

Box mybox1 = new Box(10, 20, 15);

Box mybox2 = new Box();

Box mycube = new Box(7);

double vol;

// get volume of first box

vol = mybox1.volume();

System.out.println("Volume of mybox1 is " + vol);

// get volume of second box

vol = mybox2.volume();

System.out.println("Volume of mybox2 is " + vol);

// get volume of cube

vol = mycube.volume();

System.out.println("Volume of mycube is " + vol);

Output
Volume of mybox1 is 3000.0
Volume of mybox2 is 0.0
Volume of mycube is 343.0

 Java Classes
A class in Java is a set of objects which shares common characteristics/
behavior and common properties/ attributes. It is a user-defined blueprint or
prototype from which objects are created. For example, Student is a class
while a particular student named Ravi is an object.
Properties of Java Classes
1. Class is not a real-world entity. It is just a template or blueprint or
prototype from which objects are created.
2. Class does not occupy memory.
3. Class is a group of variables of different data types and a group of
methods.
4. A Class in Java can contain:
 Data member
 Method
 Constructor
 Nested Class
 Interface
Class Declaration in Java
access_modifier class <class_name>
{
data member;
method;
constructor;
nested class;
interface;
}

Example of Java Class


 Java
 Java
 Java

// Java Program for class example


class Student {

// data member (also instance variable)

int id;

// data member (also instance variable)

String name;

public static void main(String args[])

// creating an object of

// Student

Student s1 = new Student();

System.out.println(s1.id);

System.out.println(s1.name);

Output 1
0
null

Output 2
GeeksForGeeks

Output 3
GeeksForGeeks

You might also like