Installation of Java
Installation of Java
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’.
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
// Base Class
class Parent {
// Inherited class
System.out.println("Child's show()");
}
}
// Driver class
class Main {
// show is called
obj1.show();
// POLYMORPHISM.
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;
Java
// Constructor Overloading
class Box {
// specified
width = w;
height = h;
depth = d;
// specified
// Driver code
double vol;
vol = mybox1.volume();
vol = mybox2.volume();
vol = mycube.volume();
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;
}
int id;
String name;
// creating an object of
// Student
System.out.println(s1.id);
System.out.println(s1.name);
Output 1
0
null
Output 2
GeeksForGeeks
Output 3
GeeksForGeeks