• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 4 fuera de 81 páginas
Resumen

Summary - Programming Fundamentals (Java OOP)

Document preview thumbnail
Vista previa 4 fuera de 81 páginas

In-depth notes covering Object Oriented Programming in Java especially. The three pillars of OOP (Encapsulation, Abstraction, Polymorphism), how the JVM works, bytecode, public and private methods, classes, objects, constructors and their relationships. Basics of fields vs methods, case and UML diagrams and relationship types, access and mutator methods, types of functions, types of variables (local and global scope), strong vs weak typing, database operators, arrays and bounds in Java, data structures and methods for the library. Types of classes, how testing works with JUnit. This covers the entirety of Java and the OOP framework.

Vista previa del contenido

Programming Fundamentals (COM1027)


Eclipse Shortcuts: https://www.digitalocean.com/community/tutorials/eclipse-
shortcuts
Windows 11 Shortcuts:
https://support.microsoft.com/en-us/windows/windows-keyboard-shortcuts-
3d444b08-3a00-abd6-67da-ecfc07e86b98


1) What is Object-Oriented Programming? Object-oriented programming (OOP) is a
programming paradigm based on the concept of
"objects", which can contain data and code: data
in the form of fields (often known as attributes or
properties), and code, in the form of procedures
(often known as methods).

2) What is Encapsulation and Abstraction? Encapsulation and Abstraction - to achieve those
two principles private, public and protected fields
are used.

3) What is Class Hierarchy? A term that is linked closely to Inheritance, here
we have subclasses or so-called child classes in the
hierarchy that inherit key components of the
parent class.

4) What is Polymorphism? Similar to inheritance but takes a step further; it
enables an object of a class to take different forms;
in other words, the child class object can take the
form or the functionality of its parent class as
well as use the defined methods to extend that
functionality and perform additional tasks.

,5) How does Java run and how is it Java applications are designed to operate on any
different from other languages? platform that has a Java Virtual Machine (JVM)
installed;
think of the JVM as a software platform to run
Java programs on.

In theory, a programmer can write a
single application in Java, and it will execute
similarly on any piece of hardware with an
installed JVM. That makes Java a write-once-
run-everywhere language, meaning that it is
platform independent.


6) How does Java work? To be platform independent, means that Java
cannot be translated directly to machine
language, therefore it introduces an intermediate
language called bytecode or *.class. The Java
source code is translated into bytecode via the
compiler, and the JVM on each device can then
determine the best way in which to execute the
bytecode instructions.




7) How is source code set up in Java? In the Java programming language, all source
code is first written in plain text files ending with
the .java extension.

A Java source code file can contain one or more
Java classes, however only one of them can be
defined as public. The name of the public class
and the filename of the source code file must
match,

8) What is Bytecode? Those source files (.java) are then compiled
into .class files by the javac compiler. A .class file
does not contain code that is native to your

, processor; but instead the machine language of
the JVM. The .class files are called bytecode.

In other words, bytecode is really a form of
intermediate language rather than a true
machine code. This means that the process of
turning Java source code into bytecode is not
really a type of compilation in the sense that a C
or C++ programmer would understand it.

During compilation if any errors are found, then
the compilation process ends. Once the errors are
fixed (removed, modified or corrected), then the
program goes through the compilation process
once again. If no errors occur, the bytecode file
(.class) is created and handed over to the Java
Virtual Machine (JVM) for interpretation.

9) What is a Java Virtual Machine? What JVM is a virtual machine used in Java
is JIT? programming platform to execute or run Java
programs. It is an engine that allocates memory
space and converts Java bytecode into machine
language, making Java platform-independent.

JIT stands for ‘Just-in-time’ compilation and it is
part of JVM responsible for executing the
compilation to native machine code.

Java is both compiled and interpreted.

10) How do you format blocks of code in The class definition must go within a pair of curly
Java? braces, { and }. Within the class you can have one
or more methods, selection statements or
repetition statements that also need curly braces,
forming nested braces: { {} {} } Whitespace and
indentation etc. is for human readability and has
no syntactic significance in Java.

Excess whitespace or ’wrong’ indentation will
have no negative effect on the compiler!

, 11) What is the difference between Public Public methods/ variables are accessible to all
and Private? classes whereas the private ones are not.

Public fields and methods are externally visible
– Public fields (external fields)
- Public methods (external methods)

»Private fields and methods are internally visible
- Private fields (internal fields)
- Private methods (internal methods)

»Internal fields are safe from external changes

»Internal methods are implementation detail
- Provide common functionality used through the
class
- Not exposed as part of the interface (or contract)
of the class

12) What is the Main Method? Main method – This is the entry/execution
starting point of a java program. In other words,
that is the first thing that runs.




13) What is a class? A class is a blueprint, template, or prototype. A
class consists of attributes (which become
fields/variables and later on define the state of the
object) and behaviours (which are executed by
methods and later on may affect the state of the
object).

A class encapsulates:
- Attributes: fields
(also known as instance variables or properties)
- Behaviour: methods

Información del documento

Estudio
Desconocido
Subido en
25 de junio de 2024
Número de páginas
81
Escrito en
2023/2024
Tipo
Resumen
$6.88

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
8
Última venta
-




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