100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Notas de lectura

Fundamentals of Java for Beginners-Part 1

Puntuación
-
Vendido
-
Páginas
19
Subido en
26-02-2023
Escrito en
2022/2023

In this Java document, we covered various topics related to Java programming. It provides an introduction to Java, covering basic syntax, data types, and control structures. It could also cover more advanced topics such as object-oriented programming, exception handling, and multithreading in Part 2.

Mostrar más Leer menos
Institución
Grado

Vista previa del contenido

INTRODUCTION TO JAVA FUNDAMENTALS


 How Java Works

Sun Microsystems first introduced Java, a high-level, object-oriented programming
language, in 1995. Java code can run on any computer or operating system that has a Java
Virtual Machine (JVM) installed because of its well-known platform freedom.

Java code is first converted into bytecode, a platform-independent format that can be run
by a JVM, when it is written. The JVM then interprets the bytecode at runtime, converting it
into machine code that the CPU of the computer may use to operate.

Classes, which are collections of related code that may be reused and shared across various
portions of the programme, are how Java programmes are organised.

Classes contain variables, which are data values that may be used by the methods, and
methods, which are discrete chunks of code that carry out duties.

A built-in memory management mechanism in Java also takes care of the automatic
allocation and deallocation of memory for programme objects. By doing so, manual memory
management is made less likely to result in memory leaks and other problems.

Overall, Java is a strong and adaptable programming language that is frequently utilised in a
wide range of applications, including enterprise software, mobile app development, and
web development. It is a popular option for developers all over the world because to its
platform freedom and powerful capabilities.



 How to Setup Java Development Kit (JDK) Setup

1. You can use the instructions below to install the Java Development Kit (JDK):
2. On the Oracle website, get the JDK:
3. Visit the Oracle website (https://www.oracle.com/java/technologies/downloads/) to
get the downloads.
4. Choose the correct JDK version for your operating system, then download it.
5. Set up the JDK:
6. Launch the installer tool you downloaded and adhere to the installation guidelines.
7. Make the environment variables available:

, 8. Set the PATH variable in the environment variables to contain the path to the bin
directory for the JDK. The Java compiler (javac) and Java runtime (java) commands
can thus be used from any directory in the command prompt thanks to this.
9. Set the JDK installation directory as the value for the JAVA HOME variable.



 Installer verification:

To make that the JDK is correctly installed, open a command prompt and execute "java -
version".

Installing an integrated development environment (IDE), such as Eclipse or IntelliJ IDEA, is an
optional step that can make creating Java programmes more user-friendly and effective.

After completing these steps, you should be prepared to begin utilising the JDK to create
Java applications.



 First Code in Java

Here is an example of a basic "Hello World" program in Java:

public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}


 Let's dissect this code:

"HelloWorld" is a public class that is declared in the first line. Every Java application must
contain at least one class, and the class name and filename must coincide (in this case,
"HelloWorld.java").

We define a public static method called "main" inside the class. The program's entry point is
where execution starts. If necessary, we can pass command-line arguments to the
programme using the "String[] args" option.

The string "Hello World!" is printed to the console using the "System.out.println" method
inside the main method.

, This programme can be run by saving it as a file named "HelloWorld.java," compiling it with
the command "javac HelloWorld.java," and then launching it with the command "java
HelloWorld". You ought to notice the message. "Hello World!" printed to the console.



 Variables in Java

A variable in Java is a named memory region where a value of a certain data type is kept. In
Java, you use the following syntax to declare a variable:

data_type variable_name;

Thus, "data type" denotes the kind of information the variable can hold (such as an int,
double, boolean, etc.), and "variable name" is the name you give the variable. For instance,
the code below would be used to declare an integer variable called "myInt":

int myInt;

Moreover, when a variable is declared, it can be initialised as follows:

data_type variable_name = initial_value;

For instance, the following code would be used to declare and create a double variable
named "myDouble" with the number 3.14:

double myDouble = 3.14;

The assignment operator "=" can be used to change a variable's value after it has been
declared.

variable_name = new_value;

For instance, the following code would be used to give the "myInt" variable a new value of
10.

myInt = 10;

Variable declaration and initialization can also be combined into a single statement:

data_type variable_name = expression;

Escuela, estudio y materia

Grado

Información del documento

Subido en
26 de febrero de 2023
Número de páginas
19
Escrito en
2022/2023
Tipo
Notas de lectura
Profesor(es)
Naveen
Contiene
Topic\'s are covered upto class and objects

Temas

$8.59
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
sandeepjangiti

Conoce al vendedor

Seller avatar
sandeepjangiti Exam Questions
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
0
Miembro desde
2 año
Número de seguidores
0
Documentos
1
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes