100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary - Programming Fundamentals (Java OOP)

Rating
-
Sold
-
Pages
81
Uploaded on
25-06-2024
Written in
2023/2024

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.

Show more Read less
Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Unknown
Course

Document information

Uploaded on
June 25, 2024
Number of pages
81
Written in
2023/2024
Type
Summary

Subjects

Content preview

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
$6.22
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
williamdaniel

Also available in package deal

Get to know the seller

Seller avatar
williamdaniel University of Surrey
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
1 year
Number of followers
0
Documents
8
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions