You are on page 1of 99

Table of Contents

Facts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2

People in techno world - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8

Java - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9

Java Terminologies- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9

Java Keywords- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 28

Java String Methods- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 33


Java Math Methods- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 35

Java Syntax- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 38
Java Comments- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 39
Java Variables- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 40
Java Data Types- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 45
Java Type Casting- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 52
Java Operators- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 54
Java Strings- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 60
Java Math- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 65
Java Booleans- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 67
Java If ... Else- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 69

Java Switch Statements- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 75


Java While Loop- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 78
Java For Loop- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 80

Java Break and Continue- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 82


Java Arrays- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 85

ASCII Table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 90

Page 1 of 99
Facts
1. The Firefox logo isn’t a fox - There is a common misbelief that because the
browser is named Firefox, the logo must be a fox.

Surprisingly, the cute furry creature in the logo is actually a red panda!

2. The first Apple logo isn’t what you would think -Originally, it featured Sir Isaac
Newton sitting beneath a tree, with an apple about to fall on his head.

It was designed back in 1976 and featured a phrase around the border which read
“Newton…A mind forever voyaging through strange seas of thought…alone”.

Seems kind of dark!


3. The name for “robot” has dark origins -If you look into the etymology of “robot,” it
comes from the Czech word “robota” which translates to forced labor or work.

The word was first used to refer to a fictional humanoid in a play in 1920.
4. The first ever VCR was the size of a piano -When the first VCR (Video Camera
Recorder) was made in 1956, it was the size of a piano.

Way bigger than I would have guessed!


5. Samsung is 38 years and 1 month older than Apple -Samsung was founded as a
grocery store on March 1, 1938, by Lee Byung-Chull.

Apple Founders Steve Jobs and Steve Wozniak created Apple Computer Inc. on April 1,
1976.
6. Megabytes used to weigh hundreds of pounds -More specifically, 5 megabytes of
data weighed one ton.

In 1956, the first computer had something similar to a hard drive.

At the time, it was a huge leap in storage capabilities, but the cabinet that contained the
hard drive weighed over 2,200 pounds and could hold 5 MBs of data.
7. The Radio took 38 years to reach an audience of 50 million -You would think the
invention of the radio would be a big deal, but it took 38 years for the radio to reach an
audience of 50 million.

Meanwhile, the iPod only took 3 years to reach the same milestone!

Page 2 of 99
8. The first camera needed an incredibly long exposure -The first photograph ever
taken in 1826 took 8 hours to expose!

The creator of that camera, Louis Daguerre, was able to lower that time drastically to
just 15 minutes in 1839.
9. Credit card chips have been around for a LONG time -To many, credit card chips
are a relatively new fad. However, the chip technology has been around since 1986!

It was first used in France, followed shortly after by Germany.


10. Mac computers were named after the apple -It’s not a coincidence that
“Macintosh” is similar to the apples called “mcintosh”.

The name was misspelled on purpose to avoid conflict with a manufacturer called
“McIntosh Laboratory”.
11. The first computer mouse wasn’t made from plastic -Back in 1964, Doug
Engelbart invented the first ever computer mouse! Back then, it was made out of wood.

It was rectangular and featured a little button on the top right.

He called it a mouse because the cord coming out of the back reminded him of the tiny
rodents.
12. Steve Jobs used sleight of hand at the first iPhone presentation - The first
iPhone presentation happened six months before the iPhone was set to hit the market.

At that time, the phone was too buggy to use, so Steve Jobs often had to switch phones
behind his desk.

Otherwise, it would run out of RAM and crash.


13. The government used PlayStation 3’s… but not for gaming - In 2010, the United
States Air Force used 1,760 PlayStation 3 consoles to build a supercomputer for the
Department of Defense.

They used PS3’s because it was more cost efficient and “green.”
14. The first online gaming was before the year 2000 - Sega Dreamcast was the first
128-bit console to hit the market.

Released in 1999, it was the first console that allowed real-time online play.

Unfortunately, it was a little too early for its time, as back then, most internet
connections were not reliable enough.

Page 3 of 99
15. The first product scanned was a packet of chewing gum in 1974 - Norman
Joseph Woodland invented the barcode, and received a patent in October 1952.
It wasn’t until 22 years later, when he was employed by IBM that the barcode was
developed to be used for product labeling.

Known as the Universal Product Code (UPC), a system that is still used today.
16. You’re in good hands if your surgeon was a gamer - Oddly enough, surgeons
that grew up playing video games more than 3 hours per week make 37% fewer errors!

Not only that, but they also had a 42% faster completion rate when it comes to
performing laparoscopic surgery, as well as suturing.
17. Nintendo didn’t start as a video games company - Founded in 1889, Nintendo
was around long before computers! So what did they sell?

From 1889-1956, Nintendo was a playing card company.

They still manufacture playing cards in Japan, and even have a bridge tournament
called the “Nintendo Cup”.
18. Yahoo’s original name was a mouthful - The original URL for Yahoo was
akebono.standford.edu.

The name Yahoo was selected because it was derived from Gulliver’s Travels slang,
“Yahoo” which was a fictional race of beings in the book.

Bonus Fact: Amazon wasn’t always Amazon either! Originally named “Cadabra.com,”
Cadabra was an online bookstore only.

CEO Jeff Bezos explored other options in the 90’s, some of which still redirect to
Amazon, like Relentless.com.

Amazon was registered in 1994, and has grown into the monolith that it is today.
Bonus Bonus Fact: When Snapchat first launched in 2011, it was named Picaboo.

It wasn’t renamed to what we know as Snapchat until 2012.


19. The Nintendo Game Boy went to space - In 1993, a Soviet cosmonaut brought his
Nintendo Game Boy to space on the TM-17 space mission.

It is said to have orbited Earth 3,000 times and was later auctioned for $1,220.
20. “Android” is gender specific - The word “Android” literally means a human with a
male robot appearance.

Page 4 of 99
The female equivalent of this word is a “Gynoid.”
21. Google searches hit the billions every month - There are over 35 billion Google
searches each month.

In May 2019, the top three most Googled words were “facebook” at 233 million
searches, “youtube” with 194 million searches, and “amazon” with 103 million searches.
22. The first cell phone call was in New York City -In 1973, the first ever mobile
phone call was made by Martin Cooper, an employee of Motorola, made from the
streets of New York City.

It wasn’t until 19 years later when Neil Papworth sent the first SMS message, which
brings us onto our next tech fact:
23. The first commercial text message was sent in 1992 -On December 3rd, 1992, a
software architect, Sema Group, used a computer to text “Merry Christmas” to a
Vodafone employee who was using a Orbitel 901 handset.

These days, over six billion texts are sent per day!
24. Over 6,000 new computer viruses are created and released every month -This
number has drastically risen since 1990, at which point there were only 50 known
computer viruses.

Today, 90% of emails contain some form of malware and most people don’t know about
it.
25. NASA’s internet speed is 91 GB per second -The average household internet
speeds are roughly 25 MB per second.

That’s usually fast enough to watch Netflix with no buffer time

And let’s face the fact, if there’s any tech company that would actually make good use
of them internet speeds, it’s NASA.
26. The Apple Lisa was the first commercial computer with a Graphical User
Interface (GUI) and a mouse -Before The Apple Lisa, all computers were text-based,
meaning you had to type out commands from a keyboard.

The name “Lisa” stands for “Logical Integrated Software Architecture”.

Lisa was also the name of Steve Job’s daughter.

Page 5 of 99
27. Some people are afraid of technology -People have all kinds of weird fears and
phobias out there, and technology is no exception!

Aptly named technophobia, this fear stemmed from the Industrial Revolution and
workers being afraid that machines would take their jobs.

It applies in a similar way to today’s society, as well as people being scared of


technology getting too advanced, such as artificial intelligence technology.

Let’s just hope this phobia doesn’t stop them from reading these technology facts!
28. Mark Zuckerberg is color blind -The founder of Facebook purposely chose a blue
color scheme because he has red-green color blindness!

To him, blue is the richest and most prominent color that he can see.
29. Finding a security bug in Facebook’s code will pay off - To be exact, Facebook pays
$500 for reporting any vulnerability in their security.

Even better, $500 is just the minimum that it starts at, so you could potentially earn
more!
30. The QWERTY keyboard was originally designed to slow you down - When
typewriters were introduced, typing too fast would jam the keys.

Using a QWERTY keyboard spaced out commonly used characters to slow typists
down and prevent jamming.

If you wanted to learn a more efficient keyboard, Dvorak is made for speed.

While we’re on the subject of keyboards and typing, did you know that on a typical work
day, a typists’ fingers will “travel” about 12.6 miles.
31. The first webpage is still running - In 1991, Tim Berners-Lee was working on
developing the World Wide Web.

That page is still up and functioning at info.cern.ch though don’t expect much.

There’s no graphics and no background, just plain text and links on how to use the
internet!
32. Tech companies often test their products in New Zealand - New Zealand is
such a diverse country with English speaking residents, it’s a great place for testing.

Page 6 of 99
But the main reason, is that since it’s somewhat isolated, news about a product failing
won’t spread very fast.
33. Most of today’s successful companies started in garages - That’s right, aside
from just Apple, other huge name companies started with humble beginnings.

HP, Google, and Microsoft all were started in a garage.


34. Most internet traffic isn’t from real humans - About 51% of internet traffic is non-
human. Over 30% is from hacking programs, spammers, and phishing.

Be careful with your computer security!


35. CAPTCHA is a long acronym - It stands for “Completely Automatic Public Turning
Test to Tell Computers and Humans Apart”.

Even though some artificial intelligence can get through CATCHPA, it’s still useful in
blocking some bots.
36. The @ symbol was chosen kind of randomly - The man who was writing email
programs had to determine how to determine the user and the machine that the user
was on.

He chose the symbol because it means “at” and it wasn’t used as much as other
symbols.
37. The first computer virus was harmless - In 1971, the first ever computer virus
was developed. Named Creeper, it was made as an experiment just to see how it
spread between computers.

The virus simply displayed the message: “I’m the creeper, catch me if you can!”

The first virus ever released into the wild was called Brain, which also wasn’t harmful.

However, it was the very first IBM PC virus.

Page 7 of 99
People in Techno World
1. Lee Byung-Chull –Founder of Samsung (March 1, 1938)
2. Steve Jobs and Steve Wozniak -Created Apple Computer Inc. (April 1, 1976)
3. Louis-Jacques-Mandé Daguerre (Louis Daguerre) - recognized for his invention of
the daguerreotype process of photography.
Daguerreotype- Was the first publicly available photographic process, widely used
during the 1840s and 1850s.
4. Doug Engelbart- invented the first computer mouse
5. Levi Hutchins-First mechanical alarm clock (1787)
6. Norman Joseph Woodland-Invented the barcode (Received patent-1952)
7. Fusajiro Yamauchi –Founder of Nintendo
8. Boyd Multerer –Founder of Xbox
9. Bill Gates and Paul Allen- Founder of Microsoft (April 4, 1975)
10. Tim Cranmer -Abacus
11. Charles Babbage- Invented computer (between 1833 and 1871)
12. Tim Berners-Lee -Invented World Wide Web in CERN (1989) Primary Author of
HTML
13. David Yang and David Filo –Founder of Yahoo
14. Jeff Bezos-Founder of Amazon
15. Maximilian Bittner -Founder of Lazada (With the backing of Rocket Internet in
2012)
16. Forrest Xiaodong Li –Founder of Shopee (2015)
17. Andy Rubin, Nick Sears and Rich Miner –Inventor of Android
18. Mark Zuckerberg-Created Facebook (February 2004)
19. Jack Dorsey, Noah Glass, Biz Stone, and Evan Williams –Founders of Twitter
(March 2006)
20. Jawed Karim, Steve Chen and Chad Hurley –Founders of Youtube
21. Marc Randolph and Reed Hastings –Founders of Netflix (August 29, 1997)

Page 8 of 99
Java
INTRODUCTION
JAVA was developed by Sun Microsystems Inc in 1991, later acquired by
Oracle Corporation. It was developed by James Gosling and Patrick Naughton. It is
a simple programming language. Writing, compiling and debugging a program is easy
in java. It helps to create modular programs and reusable code.

Why Use Java?


 Java works on different platforms (Windows, Mac, Linux, Raspberry Pi,
etc.)
 It is one of the most popular programming language in the world
 It is easy to learn and simple to use
 It is open-source and free
 It is secure, fast and powerful
 It has a huge community support (tens of millions of developers)
 Java is an object oriented language which gives a clear structure to
programs and allows code to be reused, lowering development costs
 As Java is close to C++ and C#, it makes it easy for programmers to
switch to Java or vice versa

Java Terminologies
Abstract Window Toolkit (AWT)- A collection of graphical user interface (GUI)
components that were implemented using native-platform versions of the components.
These components provide that subset of functionality which is common to all native
platforms. Largely supplanted by the Project Swing component set.

Abstract-A Java(TM) programming language keyword used in a class definition to


specify that a class is not to be instantiated, but rather inherited by other classes. An
abstract class can have abstract methods that are not implemented in the abstract
class, but in subclasses.
Abstract class-A class that contains one or more abstract methods, and therefore can
never be instantiated. Abstract classes are defined so that other classes can extend
them and make them concrete by implementing the abstract methods.
Abstract method-A method that has no implementation.
Actual parameter list- The arguments specified in a particular method call.

Page 9 of 99
Alpha value- A value that indicates the opacity of a pixel.

API-Application Programming Interface. The specification of how a programmer writing


an application accesses the behavior and state of classes and objects.

Appliances- Networked devices such as printers, Java(TM) technology-enabled


terminals, and clients, that are managed using applications built using the Java
Management API (JMAPI).
Applet- A program written in the Java(TM) programming language to run within a web
browser compatible with the Java platform, such as HotJava(TM) or Netscape
Navigator(TM).

Argument- A data item specified in a method call. An argument can be a literal value, a
variable, or an expression.

Array- A collection of data items, all of the same type, in which each item's position is
uniquely designated by an integer.

ASCII- American Standard Code for Information Interchange. A standard assignment of


7-bit numeric codes to characters.

Atomic- Refers to an operation that is never interrupted or left in an incomplete state


under any circumstance.

Bean- A reusable software component. Beans can be combined to create an


application.
Binary operator- An operator that has two arguments.
Bit- The smallest unit of information in a computer, with a value of either 0 or 1.

Bitwise operator- An operator that manipulates two values comparing each bit of one
value to the corresponding bit of the other value.
Block-In the Java(TM) programming language, any code between matching braces.
Example: { x = 1; }.

Boolean-Refers to an expression or variable that can have only a true or false value.
The Java(TM) programming language provides the boolean type and the literal values
true and false.

Bounding box-For a Raster object, the smallest rectangle that completely encloses all
the pixels that are not fully transparent.

Break-A Java(TM) programming language keyword used to resume program execution


at the statement immediately following the current statement. If followed by a label, the
program resumes execution at the labeled statement.

Page 10 of 99
Byte-A sequence of eight bits. The Java(TM) programming language provides a
corresponding byte type.

Bytecode-Machine-independent code generated by the Java(TM) compiler and


executed by the Java interpreter.

Case-A Java(TM) programming language keyword that defines a group of statements to


begin executing if a value specified matches the value defined by a preceding "switch"
keyword.
Casting-Explicit conversion from one data type to another.

Catch-A Java(TM) programming language keyword used to declare a block of


statements to be executed in the event that a Java exception, or run time error, occurs
in a preceding "try" block.

Char-A Java(TM) programming language keyword used to declare a variable of type


character.

Class-In the Java(TM) programming language, a type that defines the implementation
of a particular kind of object. A class definition defines instance and class variables and
methods, as well as specifying the interfaces the class implements and the immediate
superclass of the class. If the superclass is not explicitly specified, the superclass will
implicitly be Object.

Class method-A method that is invoked without reference to a particular object. Class
methods affect the class as a whole, not a particular instance of the class. Also called
a static method.

Classpath-A classpath is an environmental variable which tells the Java(TM) virtual


machine* and Java technology-based applications (for example, the tools located in the
JDK(TM) 1.1.X\bin directory) where to find the class libraries, including user-defined
class libraries.

Class variable-A data item associated with a particular class as a whole--not with
particular instances of the class. Class variables are defined in class definitions. Also
called a static field.

Client-In the client/server model of communcations, the client is a process that remotely
accesses resources of a compute server, such as compute power and large memory
capacity.

Codebase-Works together with the code attribute in the <APPLET> tag to give a
complete specification of where to find the main applet class file: code specifies the
name of the file, and codebase specifies the URL of the directory containing the file.

Page 11 of 99
Comment-In a program, explanatory text that is ignored by the compiler. In programs
written in the Java(TM) programming language, comments are delimited
using // or /*...*/.

Compilation unit-The smallest unit of source code that can be compiled. In the current
implementation of the Java(TM) platform, the compilation unit is a file.

Compiler-A program to translate source code into code to be executed by a computer.


The Java(TM) compiler translates source code written in the Java programming
language into bytecode for the Java virtual machine*.

Compositing-The process of superimposing one image on another to create a single


image.

Constructor-A pseudo-method that creates an object. In the Java(TM) programming


language, constructors are instance methods with the same name as their class.
Constructors are invoked using the new keyword.
Const-This is a reserved Java(TM) programming language keyword. However, it is not
used by current versions of the Java programming language.

Continue-A Java(TM) programming language keyword used to resume program


execution at the end of the current loop. If followed by a label, "continue" resumes
execution where the label occurs.

Core class-A public class (or interface) that is a standard member of the Java(TM)
Platform. The intent is that the core classes for the Java platform, at minimum, are
available on all operating systems where the Java platform runs. A program written
entirely in the Java programming language relies only on core classes, meaning it can
run anywhere.

Core Packages-The required set of APIs in a Java platform edition which must be
supported in any and all compatible implementations.

Critical section-A segment of code in which a thread uses resources (such as certain
instance variables) that can be used by other threads, but that must not be used by
them at the same time.

Declaration-A statement that establishes an identifier and associates attributes with it,
without necessarily reserving its storage (for data) or providing the implementation (for
methods).

Default-A Java(TM) programming language keyword optionally used after all "case"
conditions in a "switch" statement. If all "case" conditions are not matched by the value
of the "switch" variable, the "default" keyword will be executed.

Page 12 of 99
Definition-A declaration that reserves storage (for data) or provides implementation (for
methods).

Deprecation-Refers to a class, interface, constructor, method or field that is no longer


recommended, and may cease to exist in a future version.
Derived from-Class X is "derived from" class Y if class X extends class Y.

Distributed-Running in more than one address space.

Do-A Java(TM) programming language keyword used to declare a loop that will iterate
a block of statements. The loop`s exit condition can be specified with the "while"
keyword.
Double-A Java(TM) programming language keyword used to define a variable of type
double.

Double precision-In the Java(TM) programming language specification, describes a


floating point number that holds 64 bits of data.

Else-A Java(TM) programming language keyword used to execute a block of


statements in the case that the test condition with the "if" keyword evaluates to false.

EmbeddedJava(TM) Technology-The availability of Sun's Java 2 Platform, Micro


Edition technology under a restrictive license agreement that allows a licensee to
leverage certain Java technologies to create and deploy a closed-box application that
exposes no APIs.

Encapsulation-The localization of knowledge within a module. Because objects


encapsulate data and implementation, the user of an object can view the object as a
black box that provides services. Instance variables and methods can be added,
deleted, or changed, but as long as the services provided by the object remain the
same, code that uses the object can continue to use it without being rewritten.

Exception-An event during program execution that prevents the program from
continuing normally; generally, an error. The Java(TM) programming language supports
exceptions with the try, catch, and throw keywords.
Exception handler-A block of code that reacts to a specific type of exception. If the
exception is for an error that the program can recover from, the program can resume
executing after the exception handler has executed.
executable content-An application that runs from within an HTML file.

Extends-Class X extends class Y to add functionality, either by adding fields or


methods to class Y, or by overriding methods of class Y. An interface extends another
interface by adding methods. Class X is said to be a subclass of class Y.

Page 13 of 99
FCS-First Customer Ship. The day in which a product is released/shipped to the
customer.
Field-A data member of a class. Unless specified otherwise, a field is not static.

Final-A Java(TM) programming language keyword. You define an entity once and
cannot change it or derive from it later. More specifically: a final class cannot be
subclassed, a final method cannot be overridden and a final variable cannot change
from its initialized value.

Finally-A Java(TM) programming language keyword that executes a block of


statements regardless of whether a Java Exception, or run time error, occurred in a
block defined previously by the "try" keyword.

Float-A Java(TM) programming language keyword used to define a floating point


number variable.

For-A Java(TM) programming language keyword used to declare a loop that reiterates
statements. The programmer can specify the statements to be executed, exit
conditions, and initialization variables for the loop.

FTP-The basic Internet File Transfer Protocol. FTP, which is based on TCP/IP, enables
the fetching and storing of files between hosts on the Internet.

Formal Parameter List-The parameters specified in the definition of a particular


method.

Garbage collection-The automatic detection and freeing of memory that is no longer in


use. The Java(TM) runtime system performs garbage collection so that programmers
never explicitly free objects.

Goto-This is a reserved Java(TM) programming language keyword. However, it is not


used by current versions of the Java programming language.

GUI-Graphical User Interface. Refers to the techniques involved in using graphics,


along with a keyboard and a mouse, to provide an easy-to-use interface to some
program.

Hexadecimal-The numbering system that uses 16 as its base. The marks 0-9 and a-f
(or equivalently A-F) represent the digits 0 through 15. In programs written in the
Java(TM) programming language, hexadecimal numbers must be preceded with 0x.

Hierarchy-A classification of relationships in which each item except the top one
(known as the root) is a specialized form of the item above it. Each item can have one
or more items below it in the hierarchy. In the Java(TM) class hierarchy, the root is
the Object class.

Page 14 of 99
HotJava(TM) Browser-An easily customizable Web browser developed by Sun
Microsystems, which is written in the Java(TM) programming language.

HTML-HyperText Markup Language. This is a file format, based on SGML, for hypertext
documents on the Internet. It is very simple and allows for the embedding of images,
sounds, video streams, form fields and simple text formatting. References to other
objects are embedded using URLs.

HTTP-HyperText Transfer Protocol. The Internet protocol, based on TCP/IP, used to


fetch hypertext objects from remote hosts.
IDL-Interface Definition Language. APIs written in the Java(TM) programming language
that provide standards-based interoperability and connectivity with CORBA (Common
Object Request Broker Architecture).

Identifier-The name of an item in a program written in the Java(TM) programming


language.
If-A Java(TM) programming language keyword used to conduct a conditional test and
execute a block of statements if the test evaluates to true.

Implements-A Java(TM) programming language keyword optionally included in the


class declaration to specify any interfaces that are implemented by the current class.

Import-A Java(TM) programming language keyword used at the beginning of a source


file that can specify classes or entire packages to be referred to later without including
their package names in the reference.

Inheritance-The concept of classes automatically containing the variables and methods


defined in their supertypes.

Instance-An object of a particular class. In programs written in the Java(TM)


programming language, an instance of a class is created using the new operator
followed by the class name.
Instance method-Any method that is invoked with respect to an instance of a class. Also
called simply a method.

Instance variable-Any item of data that is associated with a particular object. Each
instance of a class has its own copy of the instance variables defined in the class. Also
called a field.

Instanceof-A two-argument Java(TM) programming language keyword that tests


whether the run-time type of its first argument is assignment compatible with its second
argument.

Page 15 of 99
Int-A Java(TM) programming language keyword used to define a variable of type
integer.

Interface-A Java(TM) programming language keyword used to define a collection of


method definitions and constant values. It can later be implemented by classes that
define this interface with the "implements" keyword.

Internet-An enormous network consisting of literally millions of hosts from many


organizations and countries around the world. It is physically put together from many
smaller networks and data travels by a common set of protocols.

IP-Internet Protocol. The basic protocol of the Internet. It enables the unreliable delivery
of individual packets from one host to another. It makes no guarantees about whether or
not the packet will be delivered, how long it will take, or if multiple packets will arrive in
the order they were sent. Protocols built on top of this add the notions of connection and
reliability.

Interpreter-A module that alternately decodes and executes every statement in some
body of code. The Java(TM) interpreter decodes and executes bytecode for the Java
virtual machine*.

JAE-Java(TM) Application Environment. The source code release of the Java


Development Kit (JDK(TM)) software.
JAR Files (.jar)-Java ARchive. A file format used for aggregating many files into one.

JAR file format-JAR (Java Archive) is a platform-independent file format that


aggregates many files into one. Multiple applets written in the Java(TM) programming
language, and their requisite components (.class files, images, sounds and other
resource files) can be bundled in a JAR file and subsequently downloaded to a browser
in a single HTTP transaction. It also supports file compression and digital signatures.

Java(TM)-Sun's trademark for a set of technologies for creating and safely running
software programs in both stand-alone and networked environments.

Java Application Environment (JAE)-The source code release of the Java


Development Kit (JDK(TM)) software.
JavaBeans(TM)-A portable, platform-independent reusable component model.

Java Blend(TM)-A product that enables developers to simplify database application


development by mapping database records to objects in the Java(TM) programming
language (Java objects) and Java objects to databases.

Java Card(TM) API-An ISO 7816-4 compliant application environment focused on


smart cards.

Page 16 of 99
JavaCheck(TM)-A tool for checking compliance of applications and applets to a
specification.

JavaChip(TM)-Sun's processor, which executes bytecode for the Java(TM) virtual


machine* natively. With a JavaChip processor, bytecode bypasses the virtual machine
or just-in-time compiler stage to go directly to the processor.

Java(TM) Compatibility Kit (JCK)-A test suite, a set of tools, and other requirements
used to certify a Java platform implementation conformant both to the applicable Java
platform specifications and to Java Software reference implementations.

Java Database Connectivity (JDBC(TM))-An industry standard for database-


independent connectivity between the Java(TM) platform and a wide range of
databases. The JDBC(TM) provides a call-level API for SQL-based database access.

Java Developer Connection(SM)-A service designed for individual developers,


providing online training, product discounts, feature articles, bug information, and early
access capabilities.

Java Development Kit (JDK(TM))-A software development environment for writing


applets and applications in the Java programming language.

Java(TM) Electronic Commerce Framework-A structured architecture for the


development of electronic commerce applications in the Java(TM) programming
language.

Java(TM) Enterprise API-This API makes it easy to create large-scale commercial and
database applications that can share multimedia data with other applications within an
organization or across the Internet. Four APIs have been designed within the Java(TM)
Enterprise API family.

Java(TM) Foundation Classes (JFC)-An extension that adds graphical user interface
class libraries to the Abstract Windowing Toolkit (AWT).

Java(TM) Interface Definition Language (IDL)-APIs written in the Java programming


language that provide standards-based interoperability and connectivity with CORBA
(Common Object Request Broker Architecture).

Java(TM) Media APIs-A set of APIs that support the integration of audio and video
clips, 2D fonts, graphics, and images as well as 3D models and telephony.
Java(TM) Media Framework-The core framework supports clocks for synchronizing
between different media (e.g., audio and video output). The standard extension
framework allows users to do full audio and video streaming.

Page 17 of 99
Java Naming and Directory Interface(TM) (JNDI)-A set of APIs that assists with the
interfacing to multiple naming and directory services.

JavaOS(TM)-An Java(TM) technology-based operating system that is optimized to run


on a variety of computing and consumer platforms. The JavaOS(TM) operating
environment provides a runtime specifically tuned to run applications written in the Java
programming language directly on hardware platforms without requiring a host
operating system.

JavaPlan(TM)-An object-oriented design and diagramming tool written in the Java(TM)


programming language.

Java(TM) Platform-Consists of a language for writing programs ("the Java(TM)


programming language"); a set of APIs, class libraries, and other programs used in
developing, compiling, and error-checking programs; and a virtual machine which loads
and executes the class files.

In addition, the Java platform is subject to a set of compatibility requirements to ensure


consistent and compatible implementations. Implementations that meet the compatibility
requirements may qualify for Sun's targeted compatibility brands.

The Java(TM) 2 platform is the current generation of the Java platform.

Java(TM) Platform Editions-A Java platform "edition" is a definitive and agreed-upon


version of the Java platform that provides the functionality needed over a broad market
segment.

An edition is comprised of two kinds of API sets: (i) "core packages," which are
essential to all implementations of a given platform edition, and (ii) "optional packages,"
which are available for a given platform edition and which may be supported in a
compatible implementation.

There are 3 distinct editions of the Java Platform:

* Java 2 Platform, Enterprise Edition:


The edition of the Java platform that is targeted at enterprises to enable development,
deployment, and management of multi-tier server-centric applications.

* Java 2 Platform, Standard Edition:


The edition of the Java platform that enables development, deployment, and
management of cross-platform, general-purpose applications.

Page 18 of 99
* Java 2 Platform, Micro Edition:
The edition of the Java platform that is targeted at small, standalone or connectable
consumer and embedded devices to enable development, deployment, and
management of applications that can scale from smart cards through mobile devices
and set-top boxes to conventional computing devices.

Java(TM) Remote Method Invocation (RMI)-A distributed object model for Java(TM)
program to Java program, in which the methods of remote objects written in the Java
programming language can be invoked from other Java virtual machines*, possibly on
different hosts.
Java(TM) Runtime Environment (JRE)-A subset of the Java Development Kit
(JDK(TM)) for end-users and developers who want to redistribute the runtime
environment alone. The Java runtime environment consists of the Java virtual
machine*, the Java core classes, and supporting files.

JavaSafe(TM)-A tool for tracking and managing source file changes, written in the
Java(TM) programming language.

JavaScript(TM)-A Web scripting language that is used in both browsers and Web
servers. Like all scripting languages, it is used primarily to tie other components
together or to accept user input.

Java Studio(TM)-The first program that allows you to easily create Java(TM)
technology-based applications and applets without having to know the Java
programming language.

Java(TM) Technologies-A set of technologies that enable the creation and safe
running of software programs in both stand-alone and networked environments.

Java(TM) virtual machine (JVM)*-Sun's specification for or implementation of a


software "execution engine" that safely and compatibly executes the byte codes in Java
class files on a microprocessor (whether in a computer or in another electronic device).

* Java HotSpot(TM) performance engine - Sun's ultra-high-performance engine for


implementing the Java runtime environment which features an adaptive compiler that
dynamically optimizes the performance of running applications.

* KJava(TM) virtual machine - Sun's small-footprint, highly optimized foundation of a


runtime environment within the Java 2 Platform, Micro Edition. Derived from the Java
virtual machine, it is targeted at small connected devices and can scale from 30KB to
approximately 128KB, depending on the target device's functionality.

* Java Card(TM) virtual machine - Sun's ultra-small-footprint, highly-optimized

Page 19 of 99
foundation of a runtime environment within the Java 2 Platform, Micro Edition. Derived
from the Java virtual machine, it is targeted at smart cards and other severely memory-
constrained devices and can run in devices with memory as small as 24K of ROM, 16K
of EEPROM, and 512 bytes of RAM.

Java Web Server(TM)-The easy-to-use, extensible, easy-to-administer, secure,


platform-independent solution to speed and simplify the deployment and management
of your Internet and Intranet Web sites. It provides immediate productivity for robust,
full-featured, Java technology-based server applications.

Java Workshop(TM)-A complete set of tools integrated into a single environment for
managing programming with Java technology. The Java Workshop software uses a
highly modular structure that enables you to easily plug new tools into the overall
structure.
Java(TM) wallet-A user interface, built on the Java(TM) Electronic Commerce
Framework, which allows for online purchases, value transfers, and administrative
functions.
JavaSpaces(TM)-A technology that provides distributed persistence and data
exchange mechanisms for code in the Java(TM) programming language.

JavaSoft(TM)-A former business unit of Sun Microsystems, Inc., currently known as


Sun Microsystems, Inc., Java Software division.

JDBC(TM)-Java(TM) Database Connectivity. An industry standard for database-


independent connectivity between the Java platform and a wide range of databases.
The JDBC interface provides a call-level API for SQL-based database access.

JDK(TM)-Java(TM) Development Kit software. A software development environment for


writing applets and application in the Java programming language.

JFC-Java(TM) Foundation Class. An extension that adds graphical user interface class
libraries to the Abstract Windowing Toolkit (AWT).

Jini(TM) Technology-Sun's Jini technology includes a set of APIs that may be


incorporated an optional package for any Java 2 platform edition. This set of APIs
enables transparent networking of devices and services and eliminates the need for
system or network administration intervention by a user.

The Jini technology is currently an optional package available on all Java 2 platform
editions.

Page 20 of 99
JMAPI-Java(TM) Management API. A collection of Java programming language classes
and interfaces that allow developers to build system, network, and service management
applications.

JNDI-Java Naming and Directory Interface(TM). A set of APIs that assist with the
interfacing to multiple naming and directory services.

JPEG-Joint Photographic Experts Group. An image file compression standard


established by this group. It achieves tremendous compression at the cost of
introducing distortions into the image which are almost always imperceptible.

JRE-Java(TM) runtime environment. A subset of the Java Developer Kit for end-users
and developers who want to redistribute the runtime environment. The Java runtime
environment consists of the Java virtual machine*, the Java core classes, and
supporting files.

Just-in-time (JIT) Compiler-A compiler that converts all of the bytecode into native
machine code just as a Java(TM) program is run. This results in run-time speed
improvements over code that is interpreted by a Java virtual machine*.

JVM-Java(TM) Virtual Machine*. The part of the Java Runtime Environment responsible
for interpreting bytecodes.

Keyword-The Java(TM) programming language sets aside words as keywords - these


words are reserved by the language itself and therefore are not available as names for
variables or methods.
Lexical-Pertaining to how the characters in source code are translated into tokens that
the compiler can understand.

Linker-A module that builds an executable, complete program from component


machine code modules. The Java(TM) linker creates a runnable program from compiled
classes.

Literal-The basic representation of any integer, floating point, or character value. For
example, 3.0 is a double-precision floating point literal, and "a" is a character literal.

Local variable-A data item known within a block, but inaccessible to code outside the
block. For example, any variable defined within a method is a local variable and can't be
used outside the method.
Long-A Java(TM) programming language keyword used to define a variable of type
long.
Member-A field or method of a class. Unless specified otherwise, a member is not
static.

Page 21 of 99
Method-A function defined in a class.

Mosaic-A program that provides a simple GUI that enables easy access to the data
stored on the Internet. These data may be simple files or hypertext documents. Mosaic
was written by a team at NCSA.

Multithreaded-Describes a program that is designed to have parts of its code execute


concurrently.
Native-A Java(TM) programming language keyword that is used in method declarations
to specify that the method is not implemented in the same Java source file, but rather in
another language.
NCSA-National Center for Supercomputer Applications.
New-A Java(TM) programming language keyword used to create an instance of a class.

Null-A Java(TM) programming language keyword used to specify an undefined value


for reference variables.

Object-The principal building blocks of object-oriented programs. Each object is a


programming unit consisting of data (instance variables) and functionality (instance
methods).

Object-oriented design-A software design method that models the characteristics of


abstract or real objects using classes and objects.

Octal-The numbering system using 8 as its base, using the numerals 0-7 as its digits. In
programs written in the Java(TM) programming language, octal numbers must be
preceded with 0.

Optional Packages-The set or sets of APIs in a Java platform edition which are
available with and may be supported in a compatible implementation.

Over time, optional packages may become required in an edition as the marketplace
requires them.

Overloading-Using one identifier to refer to multiple items in the same scope. In the
Java(TM) programming language, you can overload methods but not variables or
operators.

Overriding-Providing a different implementation of a method in a subclass of the class


that originally defined the method.
Package-A group of types. Packages are declared with the package keyword.
Peer-In networking, any functional unit in the same layer as another entity.

Page 22 of 99
PersonalJava(TM)-A Java runtime environment for network-connectable applications
on personal consumer devices for home, office, and mobile use.
Pixel-The smallest addressable picture element on a display screen or printed page.

POSIX-Portable Operating System for UNIX(TM). A standard that defines the language
interface between the UNIX operating system and application programs through a
minimal set of supported functions.
Private-A Java(TM) programming language keyword used in a method or variable
declaration. It signifies that the method or variable can only be accessed by other
elements of its class.
Process-A virtual address space containing one or more threads.
Property-Characteristics of an object that users can set, such as the color of a window.

Profiles-A Profile is a collection of Java APIs that complements one or more Java 2
Platform Editions by adding domain-specific capabilities. Profiles may also include other
defined Profiles. A profile implementation requires a Java 2 Platform Edition to create a
complete development and deployment environment in a targeted vertical market. Each
profile is subject to an associated set of compatibility requirements.

Profiles may be usable on one or more editions.

Some examples of profiles within the Java 2 Platform, Micro Edition are:

* PersonalJava(TM) - for non-PC products that need to display web-compatible Java-


based content

* Java Card(TM) - for secure smart cards and other severely memory-constrained
devices.

Protected-A Java(TM) programming language keyword used in a method or variable


declaration. It signifies that the method or variable can only be accessed by elements
residing in its class, subclasses, or classes in the same package.

Public-A Java(TM) programming language keyword used in a method or variable


declaration. It signifies that the method or variable can be accessed by elements
residing in other classes.
Raster-A line of pixels.
Reference-A data element whose value is an address.

Page 23 of 99
Return-A Java(TM) programming language keyword used to finish the execution of a
method. It can be followed by a value required by the method definition.

Root-In a hierarchy of items, the one item from which all other items are descended.
The root item has nothing above it in the hierarchy.

RPC-Remote Procedure Call. Executing what looks like a normal procedure call (or
method invocation) by sending network packets to some remote host.
Runtime system-The software environment in which programs compiled for the
Java(TM) virtual machine* can run. The runtime system includes all the code necessary
to load programs written in the Java programming language, dynamically link native
methods, manage memory, handle exceptions, and an implementation of the Java
virtual machine, which may be a Java interpreter.

Sandbox-Comprises a number of cooperating system components, ranging from


security managers that execute as part of the application, to security measures
designed into the Java(TM) virtual machine* and the language itself. The sandbox
ensures that an untrusted, and possibly malicious, application cannot gain access to
system resources.

Scope-A characteristic of an identifier that determines where the identifier can be used.
Most identifiers in the Java(TM) programming environment have either class or local
scope. Instance and class variables and methods have class scope; they can be used
outside the class and its subclasses only by prefixing them with an instance of the class
or (for class variables and methods) with the class name. All other variables are
declared within methods and have local scope; they can be used only within the
enclosing block.
Secure Socket Layer (SSL)-A protocol that allows communication between a Web
browser and a server to be encrypted for privacy.

Servlet-A server-side program that gives Java(TM) technology-enabled servers


additional functionality.

Short-A Java(TM) programming language keyword used to define a variable of type


short.

Single precision-In the Java(TM) language specification, describes a floating point


number with 32 bits of data.

SGML-Standardized Generalized Markup Language. An ISO/ANSI/ECMA standard that


specifies a way to annotate text documents with information about types of sections of a
document.

Page 24 of 99
Static-A Java(TM) programming language keyword used to define a variable as a class
variable. Classes maintain one copy of class variables regardless of how many
instances exist of that class. "static" can also be used to define a method as a Class
method. Class methods are invoked by the class instead of a specific instance, and can
only operate on class variables.
Static field-Another name for class variable.
Static method-Another name for class method.

Subarray-An array that is inside another array.

Subclass-A class that is derived from a particular class, perhaps with one or more
classes in between.
Subtype-If Type X extends or implements type Y, then X is a subtype of Y.

Superclass-A class from which a particular class is derived, perhaps with one or more
classes in between.

Super-A Java(TM) programming language keyword used to access members of a class


inherited by the class in which it appears.

Supertype-The supertypes of a type are all the interfaces and classes that are
extended or implemented by that type.

Switch-A Java(TM) programming language keyword used to evaluate a variable that


can later be matched with a value specified by the "case" keyword in order to execute a
group of statements.
Swing Set-The code name for a collection of graphical user interface (GUI)
components that runs uniformly on any native platform which supports the Java(TM)
virtual machine*. Because they are written entirely in the Java programming language,
these components may provide functionality above and beyond that provided by native-
platform equivalents. (Contrast with AWT.)

Synchronized-A keyword in the Java programming language that, when applied to a


method or code block, guarantees that at most one thread at a time executes that code.
TCP/IP-Transmission Control Protocol based on IP. This is an Internet protocol that
provides for the reliable delivery of streams of data from one host to another.

Technology Compatibility Kit (TCK)-A test suite, a set of tools, and other
requirements used to certify an implementation of a particular Sun technology
conformant both to the applicable specifications and to Sun or Sun-designated
reference implementations.

Page 25 of 99
Thin Client-A system that runs a very light operating system with no local system
administration and executes applications delivered over the network.

This-A Java(TM) programming language keyword that can be used to represent an


instance of the class in which it appears. "this" can be used to access class variables
and methods.

Thread-The basic unit of program execution. A process can have several threads
running concurrently, each performing a different job, such as waiting for events or
performing a time-consuming job that the program doesn't need to complete before
going on. When a thread has finished its job, the thread is suspended or destroyed.

Throw-A Java(TM) programming language keyword that allows the user to throw an
exception or any class that implements the "throwable" interface.

Throws-A Java(TM) programming language keyword used in method declarations that


specify which exceptions are not handled within the method but rather passed to the
next higher level of the program.

Transient-A keyword in the Java programming language that indicates that a field is not
part of the serialized form of an object. When an object is serialized, the values of its
transient fields are not included in the serial representation, while the values of its non-
transient fields are included.

Try-A Java(TM) programming language keyword that defines a block of statements that
may throw a Java language exception. If an exception is thrown, an optional "catch"
block can handle specific exceptions thrown within the "try" block. Also, an optional
"finally" block will be executed regardless of whether an exception is thrown or not.
Type-A class or interface.

Unicode-A 16-bit character set defined by ISO 10646. All source code in the Java(TM)
programming environment is written in Unicode.

URL-Uniform Resource Locator. A standard for writing a text reference to an arbitrary


piece of data in the WWW. A URL looks like "protocol://host/localinfo" where protocol
specifies a protocol to use to fetch the object (like HTTP or FTP), host specifies the
Internet name of the host on which to find it, and localinfo is a string (often a file name)
passed to the protocol handler on the remote host.

Variable-An item of data named by an identifier. Each variable has a type, such
as int or Object, and a scope.

Virtual machine-An abstract specification for a computing device that can be


implemented in different ways, in software or hardware. You compile to the instruction
set of a virtual machine much like you'd compile to the instruction set of a

Page 26 of 99
microprocessor. The Java(TM) virtual machine* consists of a bytecode instruction set, a
set of registers, a stack, a garbage-collected heap, and an area for storing methods.

Void-A Java(TM) programming language keyword used in method declarations to


specify that the method does not return any value. "void" can also be used as a
nonfunctional statement.

Volatile-A Java(TM) programming language keyword used in variable declarations that


specifies that the variable is modified asynchronously by concurrently running threads.

Wait-A UNIX® command which will wait for all background processes to complete, and
report their termination status.

While-A Java(TM) programming language keyword used to declare a loop that iterates
a block of statements. The loop`s exit condition is specified as part of the while
statement.

World Readable Files-Files on a file system that can be viewed (read) by any user. For
example: files residing on web servers can only be viewed by Internet users if their
permissions have been set to world readable.

Wrapper-An object that encapsulates and delegates to another object to alter its
interface or behavior in some way.

Page 27 of 99
Java Keywords
Keyword Description

abstract A non-access modifier. Used for classes and methods: An


abstract class cannot be used to create objects (to access it, it
must be inherited from another class). An abstract method
can only be used in an abstract class, and it does not have a
body. The body is provided by the subclass (inherited from)

assert For debugging

boolean A data type that can only store true and false values

break Breaks out of a loop or a switch block

byte A data type that can store whole numbers from -128 and 127

case Marks a block of code in switch statements

catch Catches exceptions generated by try statements

char A data type that is used to store a single character

class Defines a class

continue Continues to the next iteration of a loop

const Defines a constant. Not in use - use final instead

Page 28 of 99
default Specifies the default block of code in a switch statement

do Used together with while to create a do-while loop

double A data type that can store whole numbers from 1.7e−308 to
1.7e+308

else Used in conditional statements

enum Declares an enumerated (unchangeable) type

exports Exports a package with a module. New in Java 9

extends Extends a class (indicates that a class is inherited from


another class)

final A non-access modifier used for classes, attributes and


methods, which makes them non-changeable (impossible to
inherit or override)

finally Used with exceptions, a block of code that will be executed no


matter if there is an exception or not

float A data type that can store whole numbers from 3.4e−038 to
3.4e+038

for Create a for loop

goto Not in use, and has no function

Page 29 of 99
if Makes a conditional statement

implements Implements an interface

import Used to import a package, class or interface

instanceof Checks whether an object is an instance of a specific class or


an interface

int A data type that can store whole numbers from -2147483648
to 2147483647

interface Used to declare a special type of class that only contains


abstract methods

long A data type that can store whole numbers from -


9223372036854775808 to 9223372036854775808

module Declares a module. New in Java 9

native Specifies that a method is not implemented in the same Java


source file (but in another language)

new Creates new objects

package Declares a package

private An access modifier used for attributes, methods and


constructors, making them only accessible within the declared
class

Page 30 of 99
protected An access modifier used for attributes, methods and
constructors, making them accessible in the same package
and subclasses

public An access modifier used for classes, attributes, methods and


constructors, making them accessible by any other class

requires Specifies required libraries inside a module. New in Java 9

return Finished the execution of a method, and can be used to return


a value from a method

short A data type that can store whole numbers from -32768 to
32767

static A non-access modifier used for methods and attributes. Static


methods/attributes can be accessed without creating an
object of a class

strictfp Restrict the precision and rounding of floating point


calculations

super Refers to superclass (parent) objects

switch Selects one of many code blocks to be executed

synchronized A non-access modifier, which specifies that methods can only


be accessed by one thread at a time

this Refers to the current object in a method or constructor

Page 31 of 99
throw Creates a custom error

throws Indicates what exceptions may be thrown by a method

transient A non-accesss modifier, which specifies that an attribute is


not part of an object's persistent state

try Creates a try...catch statement

var Declares a variable. New in Java 10

void Specifies that a method should not have a return value

volatile Indicates that an attribute is not cached thread-locally, and is


always read from the "main memory"

while Creates a while loop

Page 32 of 99
Java String Methods
Method Description Return Type
charAt() Returns the character at the specified char
index (position)
codePointAt() Returns the Unicode of the character at int
the specified index
codePointBefore() Returns the Unicode of the character int
before the specified index
codePointCount() Returns the Unicode in the specified int
text range of this String
compareTo() Compares two strings lexicographically int
compareToIgnoreCase() Compares two strings lexicographically, int
ignoring case differences
concat() Appends a string to the end of another String
string
contains() Checks whether a string contains a boolean
sequence of characters
contentEquals() Checks whether a string contains the boolean
exact same sequence of characters of
the specified CharSequence or
StringBuffer
copyValueOf() Returns a String that represents the String
characters of the character array
endsWith() Checks whether a string ends with the boolean
specified character(s)
equals() Compares two strings. Returns true if boolean
the strings are equal, and false if not
equalsIgnoreCase() Compares two strings, ignoring case boolean
considerations
format() Returns a formatted string using the String
specified locale, format string, and
arguments
getBytes() Encodes this String into a sequence of byte[]
bytes using the named charset, storing
the result into a new byte array
getChars() Copies characters from a string to an void
array of chars
hashCode() Returns the hash code of a string int
indexOf() Returns the position of the first found int
occurrence of specified characters in a
string
intern() Returns the index within this string of String
the first occurrence of the specified

Page 33 of 99
character, starting the search at the
specified index
isEmpty() Checks whether a string is empty or not boolean
lastIndexOf() Returns the position of the last found int
occurrence of specified characters in a
string
length() Returns the length of a specified string int
matches() Searches a string for a match against a boolean
regular expression, and returns the
matches
offsetByCodePoints() Returns the index within this String that int
is offset from the given index by
codePointOffset code points
regionMatches() Tests if two string regions are equal boolean
replace() Searches a string for a specified value, String
and returns a new string where the
specified values are replaced
replaceFirst() Replaces the first occurrence of a String
substring that matches the given
regular expression with the given
replacement
replaceAll() Replaces each substring of this string String
that matches the given regular
expression with the given replacement
split() Splits a string into an array of String[]
substrings
startsWith() Checks whether a string starts with boolean
specified characters
subSequence() Returns a new character sequence that CharSequence
is a subsequence of this sequence
substring() Extracts the characters from a string, String
beginning at a specified start position,
and through the specified number of
character
toCharArray() Converts this string to a new character char[]
array
toLowerCase() Converts a string to lower case letters String
toString() Returns the value of a String object String
toUpperCase() Converts a string to upper case letters String
trim() Removes whitespace from both ends of String
a string
valueOf() Returns the primitive value of a String String
object

Page 34 of 99
Java Math Methods
Method Description Return Type

abs(x) Returns the absolute value of x double|float|int|long

acos(x) Returns the arccosine of x, in radians double

asin(x) Returns the arcsine of x, in radians double

atan(x) Returns the arctangent of x as a double


numeric value between -PI/2 and
PI/2 radians

atan2(y,x) Returns the angle theta from the double


conversion of rectangular coordinates
(x, y) to polar coordinates (r, theta).

cbrt(x) Returns the cube root of x double

ceil(x) Returns the value of x rounded up to double


its nearest integer

copySign(x, y) Returns the first floating point x with double


the sign of the second floating point y

cos(x) Returns the cosine of x (x is in double


radians)

cosh(x) Returns the hyperbolic cosine of a double


double value

exp(x) Returns the value of Ex double

expm1(x) Returns ex -1 double

floor(x) Returns the value of x rounded down double


to its nearest integer

getExponent(x) Returns the unbiased exponent used int


in x

hypot(x, y) Returns sqrt(x2 +y2) without double


intermediate overflow or underflow

Page 35 of 99
IEEEremainder(x, Computes the remainder operation double
y) on x and y as prescribed by the IEEE
754 standard

log(x) Returns the natural logarithm (base double


E) of x

log10(x) Returns the base 10 logarithm of x double

log1p(x) Returns the natural logarithm (base double


E) of the sum of x and 1

max(x, y) Returns the number with the highest double|float|int|long


value

min(x, y) Returns the number with the lowest double|float|int|long


value

nextAfter(x, y) Returns the floating point number double|float


adjacent to x in the direction of y

nextUp(x) Returns the floating point value double|float


adjacent to x in the direction of
positive infinity

pow(x, y) Returns the value of x to the power double


of y

random() Returns a random number between 0 double


and 1

round(x) Returns the value of x rounded to its int


nearest integer

rint() Returns the double value that is double


closest to x and equal to a
mathematical integer

signum(x) Returns the sign of x double

sin(x) Returns the sine of x (x is in radians) double

sinh(x) Returns the hyperbolic sine of a double


double value

sqrt(x) Returns the square root of x double

Page 36 of 99
tan(x) Returns the tangent of an angle double

tanh(x) Returns the hyperbolic tangent of a double


double value

toDegrees(x) Converts an angle measured in double


radians to an approx. equivalent
angle measured in degrees

toRadians(x) Converts an angle measured in double


degrees to an approx. angle
measured in radians

ulp(x) Returns the size of the unit of least double|float


precision (ulp) of x

Page 37 of 99
Java Syntax
1.MyClass.java

public class MyClass {

public static void main(String[] args) {

System.out.println("Hello World");

Example explained
Every line of code that runs in Java must be inside a class. In our example, we
named the class MyClass. A class should always start with an uppercase first
letter.

Note: Java is case-sensitive: "MyClass" and "myclass" has different meaning.

The name of the java file must match the class name. When saving the file,
save it using the class name and add ".java" to the end of the filename. To run
the example above on your computer, make sure that Java is properly installed:
The output should be:

Hello World

2. The main Method

The main() method is required and you will see it in every Java program:

public static void main(String[] args)

Any code inside the main() method will be executed. You don't have to
understand the keywords before and after main. You will get to know them bit
by bit while reading this tutorial.

For now, just remember that every Java program has a class name which must
match the filename, and that every program must contain the main() method.

Page 38 of 99
3. System.out.println()

Inside the main() method, we can use the println() method to print a line of text
to the screen:

public static void main(String[] args) {

System.out.println("Hello World");

Note: The curly braces {} marks the beginning and the end of a block of code.

Note: Each code statement must end with a semicolon.

Java Comments
Comments can be used to explain Java code, and to make it more readable. It
can also be used to prevent execution when testing alternative code.

Single-line comments start with two forward slashes (//).

Any text between // and the end of the line is ignored by Java (will not be
executed).

This example uses a single-line comment before a line of code:

Example
// This is a comment

System.out.println("Hello World");

This example uses a single-line comment at the end of a line of code:

Example
System.out.println("Hello World"); // This is a comment

Page 39 of 99
Java Multi-line Comments
Multi-line comments start with /* and ends with */.

Any text between /* and */ will be ignored by Java.

This example uses a multi-line comment (a comment block) to explain the


code:

Example
/* The code below will print the words Hello World

to the screen, and it is amazing */

System.out.println("Hello World");

Single or multi-line comments?


It is up to you which you want to use. Normally, we use // for short comments,
and /* */ for longer.

Java Variables
Variables are containers for storing data values.

In Java, there are different types of variables, for example:

 String - stores text, such as "Hello". String values are surrounded by


double quotes
 int - stores integers (whole numbers), without decimals, such as 123 or -
123
 float - stores floating point numbers, with decimals, such as 19.99 or -
19.99
 char - stores single characters, such as 'a' or 'B'. Char values are
surrounded by single quotes
 boolean - stores values with two states: true or false

Page 40 of 99
Declaring (Creating) Variables
To create a variable, you must specify the type and assign it a value:

Syntax
type variable = value;

Where type is one of Java's types (such as int or String), and variable is the
name of the variable (such as x or name). The equal sign is used to assign
values to the variable.

To create a variable that should store text, look at the following example:

Example
Create a variable called name of type String and assign it the value "John":

String name = "John";

System.out.println(name);

To create a variable that should store a number, look at the following example:

Example
Create a variable called myNum of type int and assign it the value 15:

int myNum = 15;

System.out.println(myNum);

You can also declare a variable without assigning the value, and assign the
value later:

Example
int myNum;

myNum = 15;

System.out.println(myNum);

Page 41 of 99
Note that if you assign a new value to an existing variable, it will overwrite the
previous value:

Example
Change the value of myNum from 15 to 20:

int myNum = 15;

myNum = 20; // myNum is now 20

System.out.println(myNum);

Final Variables
However, you can add the final keyword if you don't want others (or yourself)
to overwrite existing values (this will declare the variable as "final" or
"constant", which means unchangeable and read-only):

Example
final int myNum = 15;

myNum = 20; // will generate an error: cannot assign a value to a final


variable

Other Types
A demonstration of how to declare variables of other types:

Example
int myNum = 5;

float myFloatNum = 5.99f;

char myLetter = 'D';

boolean myBool = true;

String myText = "Hello";

Page 42 of 99
Display Variables
The println() method is often used to display variables.

To combine both text and a variable, use the + character:

Example
String name = "John";

System.out.println("Hello " + name);

You can also use the + character to add a variable to another variable:

Example
String firstName = "John ";

String lastName = "Doe";

String fullName = firstName + lastName;

System.out.println(fullName);

For numeric values, the + character works as a mathematical operator (notice


that we use int (integer) variables here):

Example
int x = 5;

int y = 6;

System.out.println(x + y); // Print the value of x + y

From the example above, you can expect:

 x stores the value 5


 y stores the value 6
 Then we use the println() method to display the value of x + y, which
is 11

Page 43 of 99
Declare Many Variables
To declare more than one variable of the same type, use a comma-separated
list:

Example
int x = 5, y = 6, z = 50;

System.out.println(x + y + z);

Java Identifiers
All Java variables must be identified with unique names.

These unique names are called identifiers.

Identifiers can be short names (like x and y) or more descriptive names (age,
sum, totalVolume).

Note: It is recommended to use descriptive names in order to create


understandable and maintainable code.

The general rules for constructing names for variables (unique identifiers) are:

 Names can contain letters, digits, underscores, and dollar signs


 Names must begin with a letter
 Names should start with a lowercase letter and it cannot contain
whitespace
 Names can also begin with $ and _ (but we will not use it in this tutorial)
 Names are case sensitive ("myVar" and "myvar" are different variables)
 Reserved words (like Java keywords, such as int or boolean) cannot be
used as names

Page 44 of 99
Java Data Types
As explained in the previous chapter, a variable in Java must be a specified data
type:

Example
int myNum = 5; // Integer (whole number)

float myFloatNum = 5.99f; // Floating point number

char myLetter = 'D'; // Character

boolean myBool = true; // Boolean

String myText = "Hello"; // String

Data types are divided into two groups:

 Primitive data types -


includes byte, short, int, long, float, double, boolean and char
 Non-primitive data types - such as String, Arrays and Classes (you will
learn more about these in a later chapter)

Primitive Data Types


A primitive data type specifies the size and type of variable values, and it has
no additional methods.

There are eight primitive data types in Java:

Page 45 of 99
Data Type Size Description

Byte 1 byte Stores whole numbers from -128 to 127

short 2 bytes Stores whole numbers from -32,768 to 32,767

Int 4 bytes Stores whole numbers from -2,147,483,648 to


2,147,483,647

Long 8 bytes Stores whole numbers from -9,223,372,036,854,775,808


to 9,223,372,036,854,775,807

Float 4 bytes Stores fractional numbers. Sufficient for storing 6 to 7


decimal digits

double 8 bytes Stores fractional numbers. Sufficient for storing 15


decimal digits

boolean 1 bit Stores true or false values

Char 2 bytes Stores a single character/letter or ASCII values

Page 46 of 99
Numbers
Primitive number types are divided into two groups:

Integer types stores whole numbers, positive or negative (such as 123 or -


456), without decimals. Valid types are byte, short, int and long. Which type you
should use, depends on the numeric value.

Floating point types represents numbers with a fractional part, containing one
or more decimals. There are two types: float and double.

Even though there are many numeric types in Java, the most used for numbers
are int (for whole numbers) and double (for floating point numbers). However,
we will describe them all as you continue to read.

Integer Types
Byte
The byte data type can store whole numbers from -128 to 127. This can be used
instead of int or other integer types to save memory when you are certain that
the value will be within -128 and 127:

Example
byte myNum = 100;

System.out.println(myNum);

Short
The short data type can store whole numbers from -32768 to 32767:

Example
short myNum = 5000;

System.out.println(myNum);

Page 47 of 99
Int
The int data type can store whole numbers from -2147483648 to
2147483647. In general, and in our tutorial, the int data type is the preferred
data type when we create variables with a numeric value.

Example
int myNum = 100000;

System.out.println(myNum);

Long
The long data type can store whole numbers from -9223372036854775808 to
9223372036854775807. This is used when int is not large enough to store the
value. Note that you should end the value with an "L":

Example
long myNum = 15000000000L;

System.out.println(myNum);

Floating Point Types


You should use a floating point type whenever you need a number with a
decimal, such as 9.99 or 3.14515.

Float
The float data type can store fractional numbers from 3.4e−038 to 3.4e+038.
Note that you should end the value with an "f":

Example
float myNum = 5.75f;

System.out.println(myNum);

Page 48 of 99
Double
The double data type can store fractional numbers from 1.7e−308 to 1.7e+308.
Note that you should end the value with a "d":

Example
double myNum = 19.99d;

System.out.println(myNum);

Use float or double?

The precision of a floating point value indicates how many digits the value can
have after the decimal point. The precision of float is only six or seven decimal
digits, while double variables have a precision of about 15 digits. Therefore it is
safer to use double for most calculations.

Scientific Numbers
A floating point number can also be a scientific number with an "e" to indicate
the power of 10:

Example
float f1 = 35e3f;

double d1 = 12E4d;

System.out.println(f1);

System.out.println(d1);

Page 49 of 99
Booleans
A boolean data type is declared with the boolean keyword and can only take the
values true or false:

Example
boolean isJavaFun = true;

boolean isFishTasty = false;

System.out.println(isJavaFun); // Outputs true

System.out.println(isFishTasty); // Outputs false

Boolean values are mostly used for conditional testing, which you will learn
more about in a later chapter.

Characters
The char data type is used to store a single character. The character must be
surrounded by single quotes, like 'A' or 'c':

Example
char myGrade = 'B';

System.out.println(myGrade);

Alternatively, you can use ASCII values to display certain characters:

Example
char a = 65, b = 66, c = 67;

System.out.println(a);

System.out.println(b);

System.out.println(c);

Page 50 of 99
Tip: A list of all ASCII values can be found in our ASCII Table Reference.

Strings
The String data type is used to store a sequence of characters (text). String
values must be surrounded by double quotes:

Example
String greeting = "Hello World";

System.out.println(greeting);

The String type is so much used and integrated in Java, that some call it "the
special ninth type".

A String in Java is actually a non-primitive data type, because it refers to an


object. The String object has methods that is used to perform certain operations
on strings. Don't worry if you don't understand the term "object" just
yet. We will learn more about strings and objects in a later chapter.

Non-Primitive Data Types


Non-primitive data types are called reference types because they refer to
objects.

The main difference between primitive and non-primitive data types are:

 Primitive types are predefined (already defined) in Java. Non-primitive


types are created by the programmer and is not defined by Java (except
for String).
 Non-primitive types can be used to call methods to perform certain
operations, while primitive types cannot.
 A primitive type has always a value, while non-primitive types can
be null.
 A primitive type starts with a lowercase letter, while non-primitive types
starts with an uppercase letter.
 The size of a primitive type depends on the data type, while non-primitive
types have all the same size.

Page 51 of 99
Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc. You
will learn more about these in a later chapter.

Java Type Casting


Type casting is when you assign a value of one primitive data type to another
type.

In Java, there are two types of casting:

 Widening Casting (automatically) - converting a smaller type to a larger


type size
byte -> short -> char -> int -> long -> float -> double

 Narrowing Casting (manually) - converting a larger type to a smaller


size type
double -> float -> long -> int -> char -> short -> byte

Widening Casting
Widening casting is done automatically when passing a smaller size type to a
larger size type:

Example
public class MyClass {

public static void main(String[] args) {

int myInt = 9;

double myDouble = myInt; // Automatic casting: int to double

System.out.println(myInt); // Outputs 9

System.out.println(myDouble); // Outputs 9.0

Page 52 of 99
Narrowing Casting
Narrowing casting must be done manually by placing the type in parentheses in
front of the value:

Example
public class MyClass {

public static void main(String[] args) {

double myDouble = 9.78;

int myInt = (int) myDouble; // Manual casting: double to int

System.out.println(myDouble); // Outputs 9.78

System.out.println(myInt); // Outputs 9

Page 53 of 99
Java Operators
Operators are used to perform operations on variables and values.

In the example below, we use the + operator to add together two values:

Example
int x = 100 + 50;

Although the + operator is often used to add together two values, like in the
example above, it can also be used to add together a variable and a value, or a
variable and another variable:

Example
int sum1 = 100 + 50; // 150 (100 + 50)

int sum2 = sum1 + 250; // 400 (150 + 250)

int sum3 = sum2 + sum2; // 800 (400 + 400)

Java divides the operators into the following groups:

 Arithmetic operators
 Assignment operators
 Comparison operators
 Logical operators
 Bitwise operators

Page 54 of 99
Arithmetic Operators
Arithmetic operators are used to perform common mathematical operations.

Operator Name Description Example

+ Addition Adds together two values x+y

- Subtraction Subtracts one value from another x-y

* Multiplication Multiplies two values x*y

/ Division Divides one value from another x/y

% Modulus Returns the division remainder x%y

++ Increment Increases the value of a variable by 1 ++x

-- Decrement Decreases the value of a variable by 1 --x

Page 55 of 99
Java Assignment Operators
Assignment operators are used to assign values to variables.

In the example below, we use the assignment operator (=) to assign the
value 10 to a variable called x:

Example
int x = 10;

The addition assignment operator (+=) adds a value to a variable:

Example
int x = 10;

x += 5;

A list of all assignment operators:

Operator Example Same As

= x=5 x=5

+= x += 3 x=x+3

-= x -= 3 x=x-3

*= x *= 3 x=x*3

Page 56 of 99
/= x /= 3 x=x/3

%= x %= 3 x=x%3

&= x &= 3 x=x&3

|= x |= 3 x=x|3

^= x ^= 3 x=x^3

>>= x >>= 3 x = x >> 3

<<= x <<= 3 x = x << 3

Page 57 of 99
Java Comparison Operators
Comparison operators are used to compare two values:

Operator Name Example

== Equal to x == y

!= Not equal x != y

> Greater than x>y

< Less than x<y

>= Greater than or equal to x >= y

<= Less than or equal to x <= y

Page 58 of 99
Java Logical Operators
Logical operators are used to determine the logic between variables or values:

Operator Name Description Example

&& Logical and Returns true if both x < 5 && x


statements are true < 10

|| Logical or Returns true if one of the x < 5 || x <


statements is true 4

! Logical not Reverse the result, returns !(x < 5 && x


false if the result is true < 10)

Page 59 of 99
Java Strings
Strings are used for storing text.

A String variable contains a collection of characters surrounded by double


quotes:

Example
Create a variable of type String and assign it a value:

String greeting = "Hello";

String Length
A String in Java is actually an object, which contain methods that can perform
certain operations on strings. For example, the length of a string can be found
with the length() method:

Example
String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

System.out.println("The length of the txt string is: " + txt.length());

More String Methods


There are many string methods available, for
example toUpperCase() and toLowerCase():

Example
String txt = "Hello World";

System.out.println(txt.toUpperCase()); // Outputs "HELLO WORLD"

System.out.println(txt.toLowerCase()); // Outputs "hello world"

Page 60 of 99
Finding a Character in a String
The indexOf() method returns the index (the position) of the first occurrence of
a specified text in a string (including whitespace):

Example
String txt = "Please locate where 'locate' occurs!";

System.out.println(txt.indexOf("locate")); // Outputs 7

Java counts positions from zero.


0 is the first position in a string, 1 is the second, 2 is the third ...

String Concatenation
The + operator can be used between strings to combine them. This is
called concatenation:

Example
String firstName = "John";

String lastName = "Doe";

System.out.println(firstName + " " + lastName);

Note that we have added an empty text (" ") to create a space between
firstName and lastName on print.

You can also use the concat() method to concatenate two strings:

Example
String firstName = "John ";

String lastName = "Doe";

System.out.println(firstName.concat(lastName));

Page 61 of 99
Special Characters
Because strings must be written within quotes, Java will misunderstand this
string, and generate an error:

String txt = "We are the so-called "Vikings" from the north.";

The solution to avoid this problem, is to use the backslash escape character.

The backslash (\) escape character turns special characters into string
characters:

Escape character Result Description

\' ' Single quote

\" " Double quote

\\ \ Backslash

The sequence \" inserts a double quote in a string:

Example
String txt = "We are the so-called \"Vikings\" from the north.";

The sequence \' inserts a single quote in a string:

Example
String txt = "It\'s alright.";

The sequence \\ inserts a single backslash in a string:

Page 62 of 99
Example
String txt = "The character \\ is called backslash.";

Six other escape sequences are valid in Java:

Code Result

\n New Line

\r Carriage Return

\t Tab

\b Backspace

\f Form Feed

Adding Numbers and Strings


WARNING!

Java uses the + operator for both addition and concatenation.

Numbers are added. Strings are concatenated.

If you add two numbers, the result will be a number:

Page 63 of 99
Example
int x = 10;

int y = 20;

int z = x + y; // z will be 30 (an integer/number)

If you add two strings, the result will be a string concatenation:

Example
String x = "10";

String y = "20";

String z = x + y; // z will be 1020 (a String)

If you add a number and a string, the result will be a string concatenation:

Example
String x = "10";

int y = 20;

String z = x + y; // z will be 1020 (a String)

Page 64 of 99
Java Math
The Java Math class has many methods that allows you to perform
mathematical tasks on numbers.

Math.max(x,y)
The Math.max(x,y) method can be used to find the highest value of x and y:

Example
Math.max(5, 10);

Math.min(x,y)
The Math.min(x,y) method can be used to find the lowest value of of x and y:

Example
Math.min(5, 10);

Math.sqrt(x)
The Math.sqrt(x) method returns the square root of x:

Example
Math.sqrt(64);

Page 65 of 99
Math.abs(x)
The Math.abs(x) method returns the absolute (positive) value of x:

Example
Math.abs(-4.7);

Math.random()
Math.random() returns a random number between 0 (inclusive), and 1 (exclusive):

Example
Math.random();

Page 66 of 99
Java Booleans
Very often, in programming, you will need a data type that can only have one of
two values, like:

 YES / NO
 ON / OFF
 TRUE / FALSE

For this, Java has a boolean data type, which can take the values true or false.

Boolean Values
A boolean type is declared with the boolean keyword and can only take the
values true or false:

Example
boolean isJavaFun = true;

boolean isFishTasty = false;

System.out.println(isJavaFun); // Outputs true

System.out.println(isFishTasty); // Outputs false

However, it is more common to return boolean values from boolean


expressions, for conditional testing (see below).

Boolean Expression
A Boolean expression is a Java expression that returns a Boolean
value: true or false.

You can use a comparison operator, such as the greater than (>) operator to
find out if an expression (or a variable) is true:

Page 67 of 99
Example
int x = 10;

int y = 9;

System.out.println(x > y); // returns true, because 10 is higher than 9

Or even easier:

Example
System.out.println(10 > 9); // returns true, because 10 is higher than 9

In the examples below, we use the equal to (==) operator to evaluate an


expression:

Example
int x = 10;

System.out.println(x == 10); // returns true, because the value of x is


equal to 10

Example
System.out.println(10 == 15); // returns false, because 10 is not equal to
15

The Boolean value of an expression is the basis for all Java comparisons and
conditions.

You will learn more about conditions in the next chapter.

Page 68 of 99
Java If ... Else
Java Conditions and If Statements
Java supports the usual logical conditions from mathematics:

 Less than: a < b


 Less than or equal to: a <= b
 Greater than: a > b
 Greater than or equal to: a >= b
 Equal to a == b
 Not Equal to: a != b

You can use these conditions to perform different actions for different decisions.

Java has the following conditional statements:

 Use if to specify a block of code to be executed, if a specified condition is


true
 Use else to specify a block of code to be executed, if the same condition
is false
 Use else if to specify a new condition to test, if the first condition is
false
 Use switch to specify many alternative blocks of code to be executed

The if Statement
Use the if statement to specify a block of Java code to be executed if a
condition is true.

Syntax
if (condition) {

// block of code to be executed if the condition is true

Page 69 of 99
Note that if is in lowercase letters. Uppercase letters (If or IF) will generate an
error.

In the example below, we test two values to find out if 20 is greater than 18. If
the condition is true, print some text:

Example
if (20 > 18) {

System.out.println("20 is greater than 18");

We can also test variables:

Example
int x = 20;

int y = 18;

if (x > y) {

System.out.println("x is greater than y");

Example explained

In the example above we use two variables, x and y, to test whether x is


greater than y (using the > operator). As x is 20, and y is 18, and we know that
20 is greater than 18, we print to the screen that "x is greater than y".

Page 70 of 99
The else Statement
Use the else statement to specify a block of code to be executed if the condition
is false.

Syntax
if (condition) {

// block of code to be executed if the condition is true

} else {

// block of code to be executed if the condition is false

Example
int time = 20;

if (time < 18) {

System.out.println("Good day.");

} else {

System.out.println("Good evening.");

// Outputs "Good evening."

Example explained

In the example above, time (20) is greater than 18, so the condition is false.
Because of this, we move on to the else condition and print to the screen "Good
evening". If the time was less than 18, the program would print "Good day".

Page 71 of 99
The else if Statement
Use the else if statement to specify a new condition if the first condition
is false.

Syntax
if (condition1) {

// block of code to be executed if condition1 is true

} else if (condition2) {

// block of code to be executed if the condition1 is false and


condition2 is true

} else {

// block of code to be executed if the condition1 is false and


condition2 is false

Example
int time = 22;

if (time < 10) {

System.out.println("Good morning.");

} else if (time < 20) {

System.out.println("Good day.");

} else {

System.out.println("Good evening.");

// Outputs "Good evening."

Page 72 of 99
Example explained

In the example above, time (22) is greater than 10, so the first
condition is false. The next condition, in the else if statement, is also false, so
we move on to the else condition since condition1 and condition2 is
both false - and print to the screen "Good evening".

However, if the time was 14, our program would print "Good day."

Short Hand If...Else (Ternary Operator)


There is also a short-hand if else, which is known as the ternary
operator because it consists of three operands. It can be used to replace
multiple lines of code with a single line. It is often used to replace simple if else
statements:

Syntax
variable = (condition) ? expressionTrue : expressionFalse;

Instead of writing:

Example
int time = 20;

if (time < 18) {

System.out.println("Good day.");

} else {

System.out.println("Good evening.");

Page 73 of 99
You can simply write:

Example
int time = 20;

String result = (time < 18) ? "Good day." : "Good evening.";

System.out.println(result);

Page 74 of 99
Java Switch Statements
Use the switch statement to select one of many code blocks to be executed.

Syntax
switch(expression) {

case x:

// code block

break;

case y:

// code block

break;

default:

// code block

This is how it works:

 The switch expression is evaluated once.


 The value of the expression is compared with the values of each case.
 If there is a match, the associated block of code is executed.
 The break and default keywords are optional, and will be described later
in this chapter

The example below uses the weekday number to calculate the weekday name:

Example
int day = 4;

switch (day) {

case 1:

System.out.println("Monday");

Page 75 of 99
break;

case 2:

System.out.println("Tuesday");

break;

case 3:

System.out.println("Wednesday");

break;

case 4:

System.out.println("Thursday");

break;

case 5:

System.out.println("Friday");

break;

case 6:

System.out.println("Saturday");

break;

case 7:

System.out.println("Sunday");

break;

// Outputs "Thursday" (day 4)

The break Keyword


When Java reaches a break keyword, it breaks out of the switch block.

This will stop the execution of more code and case testing inside the block.

Page 76 of 99
When a match is found, and the job is done, it's time for a break. There is no
need for more testing.

A break can save a lot of execution time because it "ignores" the execution of
all the rest of the code in the switch block.

The default Keyword


The default keyword specifies some code to run if there is no case match:

Example
int day = 4;

switch (day) {

case 6:

System.out.println("Today is Saturday");

break;

case 7:

System.out.println("Today is Sunday");

break;

default:

System.out.println("Looking forward to the Weekend");

// Outputs "Looking forward to the Weekend"

Note that if the default statement is used as the last statement in a switch
block, it does not need a break.

Page 77 of 99
Java While Loop
Loops
Loops can execute a block of code as long as a specified condition is reached.

Loops are handy because they save time, reduce errors, and they make code
more readable.

Java While Loop


The while loop loops through a block of code as long as a specified condition
is true:

Syntax
while (condition) {

// code block to be executed

In the example below, the code in the loop will run, over and over again, as
long as a variable (i) is less than 5:

Example
int i = 0;

while (i < 5) {

System.out.println(i);

i++;

Note: Do not forget to increase the variable used in the condition, otherwise
the loop will never end!

Page 78 of 99
The Do/While Loop
The do/while loop is a variant of the while loop. This loop will execute the code
block once, before checking if the condition is true, then it will repeat the loop
as long as the condition is true.

Syntax
do {

// code block to be executed

while (condition);

The example below uses a do/while loop. The loop will always be executed at
least once, even if the condition is false, because the code block is executed
before the condition is tested:

Example
int i = 0;
do {

System.out.println(i);

i++;

while (i < 5);

Do not forget to increase the variable used in the condition, otherwise the loop
will never end!

Page 79 of 99
Java For Loop
When you know exactly how many times you want to loop through a block of
code, use the for loop instead of a while loop:

Syntax
for (statement 1; statement 2; statement 3) {

// code block to be executed

Statement 1 is executed (one time) before the execution of the code block.

Statement 2 defines the condition for executing the code block.

Statement 3 is executed (every time) after the code block has been executed.

The example below will print the numbers 0 to 4:

Example
for (int i = 0; i < 5; i++) {

System.out.println(i);

Example explained

Statement 1 sets a variable before the loop starts (int i = 0).

Statement 2 defines the condition for the loop to run (i must be less than 5). If
the condition is true, the loop will start over again, if it is false, the loop will
end.

Statement 3 increases a value (i++) each time the code block in the loop has
been executed.

Page 80 of 99
Another Example
This example will only print even values between 0 and 10:

Example
for (int i = 0; i <= 10; i = i + 2) {

System.out.println(i);

For-Each Loop
There is also a "for-each" loop, which is used exclusively to loop through
elements in an array:

Syntax
for (type variableName : arrayName) {

// code block to be executed

The following example outputs all elements in the cars array, using a "for-
each" loop:

Example
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

for (String i : cars) {

System.out.println(i);

Note: Don't worry if you don't understand the example above. You will learn
more about Arrays in the Java Arrays chapter.

Page 81 of 99
Java Break and Continue
Java Break
You have already seen the break statement used in an earlier chapter of this
tutorial. It was used to "jump out" of a switch statement.

The break statement can also be used to jump out of a loop.

This example jumps out of the loop when i is equal to 4:

Example
for (int i = 0; i < 10; i++) {

if (i == 4) {

break;

System.out.println(i);

Page 82 of 99
Java Continue
The continue statement breaks one iteration (in the loop), if a specified condition
occurs, and continues with the next iteration in the loop.

This example skips the value of 4:

Example
for (int i = 0; i < 10; i++) {

if (i == 4) {

continue;

System.out.println(i);

Break and Continue in While Loop


You can also use break and continue in while loops:

Break Example
int i = 0;

while (i < 10) {

System.out.println(i);

i++;

if (i == 4) {

break;

Page 83 of 99
Continue Example
int i = 0;

while (i < 10) {

if (i == 4) {

i++;

continue;

System.out.println(i);

i++;

Page 84 of 99
Java Arrays
Arrays are used to store multiple values in a single variable, instead of declaring
separate variables for each value.

To declare an array, define the variable type with square brackets:

String[] cars;

We have now declared a variable that holds an array of strings. To insert values
to it, we can use an array literal - place the values in a comma-separated list,
inside curly braces:

String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

To create an array of integers, you could write:

int[] myNum = {10, 20, 30, 40};

Access the Elements of an Array


You access an array element by referring to the index number.

This statement accesses the value of the first element in cars:

Example
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

System.out.println(cars[0]);

// Outputs Volvo

Note: Array indexes start with 0: [0] is the first element. [1] is the second
element, etc.

Page 85 of 99
Change an Array Element
To change the value of a specific element, refer to the index number:

Example
cars[0] = "Opel";

Example
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

cars[0] = "Opel";

System.out.println(cars[0]);

// Now outputs Opel instead of Volvo

Array Length
To find out how many elements an array has, use the length property:

Example
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

System.out.println(cars.length);

// Outputs 4

Page 86 of 99
Loop Through an Array
You can loop through the array elements with the for loop, and use
the length property to specify how many times the loop should run.

The following example outputs all elements in the cars array:

Example
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

for (int i = 0; i < cars.length; i++) {

System.out.println(cars[i]);

Loop Through an Array with For-Each


There is also a "for-each" loop, which is used exclusively to loop through
elements in arrays:

Syntax
for (type variable : arrayname) {

...

The following example outputs all elements in the cars array, using a "for-
each" loop:

Example
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

for (String i : cars) {

System.out.println(i);

Page 87 of 99
The example above can be read like this: for each String element (called i - as
in index) in cars, print out the value of i.

If you compare the for loop and for-each loop, you will see that the for-
each method is easier to write, it does not require a counter (using the length
property), and it is more readable.

Multidimensional Arrays
A multidimensional array is an array containing one or more arrays.

To create a two-dimensional array, add each array within its own set of curly
braces:

Example
int[][] myNumbers = { {1, 2, 3, 4}, {5, 6, 7} };

myNumbers is now an array with two arrays as its elements.

To access the elements of the myNumbers array, specify two indexes: one for
the array, and one for the element inside that array. This example accesses the
third element (2) in the second array (1) of myNumbers:

Example
int[][] myNumbers = { {1, 2, 3, 4}, {5, 6, 7} };

int x = myNumbers[1][2];

System.out.println(x); // Outputs 7

We can also use a for loop inside another for loop to get the elements of a two-
dimensional array (we still have to point to the two indexes):

Page 88 of 99
Example
public class MyClass {

public static void main(String[] args) {

int[][] myNumbers = { {1, 2, 3, 4}, {5, 6, 7} };

for (int i = 0; i < myNumbers.length; ++i) {

for(int j = 0; j < myNumbers[i].length; ++j) {

System.out.println(myNumbers[i][j]);

}
}

Page 89 of 99
ASCII TABLE
ASCII, stands for American Standard Code for Information Interchange. It's a 7-
bit character code where every single bit represents a unique character. On this
webpage you will find 8 bits, 256 characters, ASCII table according to Windows-
1252 (code page 1252) which is a superset of ISO 8859-1 in terms of printable
characters. In the range 128 to 159 (hex 80 to 9F), ISO/IEC 8859-1 has invisible
control characters, while Windows-1252 has writable characters. Windows-1252
is probably the most-used 8-bit character encoding in the world.
ASCII control characters (character code 0-31)
The first 32 characters in the ASCII-table are unprintable control codes and are used to
control peripherals such as printers.
HTML HTML
DEC OCT HEX BIN Symbol Number Name Description
0 000 00 00000000 NUL &#000; Null char
1 001 01 00000001 SOH &#001; Start of Heading
2 002 02 00000010 STX &#002; Start of Text
3 003 03 00000011 ETX &#003; End of Text
4 004 04 00000100 EOT &#004; End of Transmission
5 005 05 00000101 ENQ &#005; Enquiry
6 006 06 00000110 ACK &#006; Acknowledgment
7 007 07 00000111 BEL &#007; Bell
8 010 08 00001000 BS &#008; Back Space
9 011 09 00001001 HT &#009; Horizontal Tab
10 012 0A 00001010 LF &#010; Line Feed
11 013 0B 00001011 VT &#011; Vertical Tab
12 014 0C 00001100 FF &#012; Form Feed
13 015 0D 00001101 CR &#013; Carriage Return
14 016 0E 00001110 SO &#014; Shift Out / X-On
15 017 0F 00001111 SI &#015; Shift In / X-Off
16 020 10 00010000 DLE &#016; Data Line Escape
17 021 11 00010001 DC1 &#017; Device Control 1 (oft. XON)
18 022 12 00010010 DC2 &#018; Device Control 2
19 023 13 00010011 DC3 &#019; Device Control 3 (oft. XOFF)

Page 90 of 99
HTML HTML
DEC OCT HEX BIN Symbol Number Name Description
20 024 14 00010100 DC4 &#020; Device Control 4
21 025 15 00010101 NAK &#021; Negative Acknowledgement
22 026 16 00010110 SYN &#022; Synchronous Idle
23 027 17 00010111 ETB &#023; End of Transmit Block
24 030 18 00011000 CAN &#024; Cancel
25 031 19 00011001 EM &#025; End of Medium
26 032 1A 00011010 SUB &#026; Substitute
27 033 1B 00011011 ESC &#027; Escape
28 034 1C 00011100 FS &#028; File Separator
29 035 1D 00011101 GS &#029; Group Separator
30 036 1E 00011110 RS &#030; Record Separator
31 037 1F 00011111 US &#031; Unit Separator

ASCII printable characters (character code 32-127)


Codes 32-127 are common for all the different variations of the ASCII table, they are
called printable characters, represent letters, digits, punctuation marks, and a few
miscellaneous symbols. You will find almost every character on your keyboard. Character
127 represents the command DEL.
HTML HTML
DEC OCT HEX BIN Symbol Number Name Description
32 040 20 00100000 &#32; Space
33 041 21 00100001 ! &#33; Exclamation mark
34 042 22 00100010 " &#34; &quot; Double quotes (or speech
marks)
35 043 23 00100011 # &#35; Number
36 044 24 00100100 $ &#36; Dollar
37 045 25 00100101 % &#37; Per cent sign
38 046 26 00100110 & &#38; &amp; Ampersand
39 047 27 00100111 ' &#39; Single quote
40 050 28 00101000 ( &#40; Open parenthesis (or open
bracket)
41 051 29 00101001 ) &#41; Close parenthesis (or close
bracket)

Page 91 of 99
HTML HTML
DEC OCT HEX BIN Symbol Number Name Description
42 052 2A 00101010 * &#42; Asterisk
43 053 2B 00101011 + &#43; Plus
44 054 2C 00101100 , &#44; Comma
45 055 2D 00101101 - &#45; Hyphen
46 056 2E 00101110 . &#46; Period, dot or full stop
47 057 2F 00101111 / &#47; Slash or divide
48 060 30 00110000 0 &#48; Zero
49 061 31 00110001 1 &#49; One
50 062 32 00110010 2 &#50; Two
51 063 33 00110011 3 &#51; Three
52 064 34 00110100 4 &#52; Four
53 065 35 00110101 5 &#53; Five
54 066 36 00110110 6 &#54; Six
55 067 37 00110111 7 &#55; Seven
56 070 38 00111000 8 &#56; Eight
57 071 39 00111001 9 &#57; Nine
58 072 3A 00111010 : &#58; Colon
59 073 3B 00111011 ; &#59; Semicolon
60 074 3C 00111100 < &#60; &lt; Less than (or open angled
bracket)
61 075 3D 00111101 = &#61; Equals
62 076 3E 00111110 > &#62; &gt; Greater than (or close angled
bracket)
63 077 3F 00111111 ? &#63; Question mark
64 100 40 01000000 @ &#64; At symbol
65 101 41 01000001 A &#65; Uppercase A
66 102 42 01000010 B &#66; Uppercase B
67 103 43 01000011 C &#67; Uppercase C
68 104 44 01000100 D &#68; Uppercase D
69 105 45 01000101 E &#69; Uppercase E
70 106 46 01000110 F &#70; Uppercase F
71 107 47 01000111 G &#71; Uppercase G
72 110 48 01001000 H &#72; Uppercase H

Page 92 of 99
HTML HTML
DEC OCT HEX BIN Symbol Number Name Description
73 111 49 01001001 I &#73; Uppercase I
74 112 4A 01001010 J &#74; Uppercase J
75 113 4B 01001011 K &#75; Uppercase K
76 114 4C 01001100 L &#76; Uppercase L
77 115 4D 01001101 M &#77; Uppercase M
78 116 4E 01001110 N &#78; Uppercase N
79 117 4F 01001111 O &#79; Uppercase O
80 120 50 01010000 P &#80; Uppercase P
81 121 51 01010001 Q &#81; Uppercase Q
82 122 52 01010010 R &#82; Uppercase R
83 123 53 01010011 S &#83; Uppercase S
84 124 54 01010100 T &#84; Uppercase T
85 125 55 01010101 U &#85; Uppercase U
86 126 56 01010110 V &#86; Uppercase V
87 127 57 01010111 W &#87; Uppercase W
88 130 58 01011000 X &#88; Uppercase X
89 131 59 01011001 Y &#89; Uppercase Y
90 132 5A 01011010 Z &#90; Uppercase Z
91 133 5B 01011011 [ &#91; Opening bracket
92 134 5C 01011100 \ &#92; Backslash
93 135 5D 01011101 ] &#93; Closing bracket
94 136 5E 01011110 ^ &#94; Caret - circumflex
95 137 5F 01011111 _ &#95; Underscore
96 140 60 01100000 ` &#96; Grave accent
97 141 61 01100001 a &#97; Lowercase a
98 142 62 01100010 b &#98; Lowercase b
99 143 63 01100011 c &#99; Lowercase c
100 144 64 01100100 d &#100; Lowercase d
101 145 65 01100101 e &#101; Lowercase e
102 146 66 01100110 f &#102; Lowercase f
103 147 67 01100111 g &#103; Lowercase g
104 150 68 01101000 h &#104; Lowercase h
105 151 69 01101001 i &#105; Lowercase i

Page 93 of 99
HTML HTML
DEC OCT HEX BIN Symbol Number Name Description
106 152 6A 01101010 j &#106; Lowercase j
107 153 6B 01101011 k &#107; Lowercase k
108 154 6C 01101100 l &#108; Lowercase l
109 155 6D 01101101 m &#109; Lowercase m
110 156 6E 01101110 n &#110; Lowercase n
111 157 6F 01101111 o &#111; Lowercase o
112 160 70 01110000 p &#112; Lowercase p
113 161 71 01110001 q &#113; Lowercase q
114 162 72 01110010 r &#114; Lowercase r
115 163 73 01110011 s &#115; Lowercase s
116 164 74 01110100 t &#116; Lowercase t
117 165 75 01110101 u &#117; Lowercase u
118 166 76 01110110 v &#118; Lowercase v
119 167 77 01110111 w &#119; Lowercase w
120 170 78 01111000 x &#120; Lowercase x
121 171 79 01111001 y &#121; Lowercase y
122 172 7A 01111010 z &#122; Lowercase z
123 173 7B 01111011 { &#123; Opening brace
124 174 7C 01111100 | &#124; Vertical bar
125 175 7D 01111101 } &#125; Closing brace
126 176 7E 01111110 ~ &#126; Equivalency sign - tilde
127 177 7F 01111111 &#127; Delete

Page 94 of 99
The extended ASCII codes (character code 128-255)
There are several different variations of the 8-bit ASCII table. The table below is
according to Windows-1252 (CP-1252) which is a superset of ISO 8859-1, also called ISO
Latin-1, in terms of printable characters, but differs from the IANA's ISO-8859-1 by using
displayable characters rather than control characters in the 128 to 159 range. Characters
that differ from ISO-8859-1 is marked by light blue color.
Symb HTML HTML
DEC OCT HEX BIN ol Number Name Description
128 200 80 10000000 € &#128; &euro; Euro sign
129 201 81 10000001
130 202 82 10000010 ‚ &#130; &sbquo; Single low-9 quotation mark
131 203 83 10000011 ƒ &#131; &fnof; Latin small letter f with hook
132 204 84 10000100 „ &#132; &bdquo; Double low-9 quotation mark
133 205 85 10000101 … &#133; &hellip; Horizontal ellipsis
134 206 86 10000110 † &#134; &dagger; Dagger
135 207 87 10000111 ‡ &#135; &Dagger; Double dagger
136 210 88 10001000 ˆ &#136; &circ; Modifier letter circumflex accent
137 211 89 10001001 ‰ &#137; &permil; Per mille sign
138 212 8A 10001010 Š &#138; &Scaron; Latin capital letter S with caron
139 213 8B 10001011 ‹ &#139; &lsaquo; Single left-pointing angle
quotation
140 214 8C 10001100 Π&#140; &OElig; Latin capital ligature OE
141 215 8D 10001101
142 216 8E 10001110 Ž &#142; Latin capital letter Z with caron
143 217 8F 10001111
144 220 90 10010000
145 221 91 10010001 ‘ &#145; &lsquo; Left single quotation mark
146 222 92 10010010 ’ &#146; &rsquo; Right single quotation mark
147 223 93 10010011 “ &#147; &ldquo; Left double quotation mark
148 224 94 10010100 ” &#148; &rdquo; Right double quotation mark
149 225 95 10010101 • &#149; &bull; Bullet
150 226 96 10010110 – &#150; &ndash; En dash
151 227 97 10010111 — &#151; &mdash; Em dash
152 230 98 10011000 ˜ &#152; &tilde; Small tilde
153 231 99 10011001 ™ &#153; &trade; Trade mark sign

Page 95 of 99
Symb HTML HTML
DEC OCT HEX BIN ol Number Name Description
154 232 9A 10011010 š &#154; &scaron; Latin small letter S with caron
155 233 9B 10011011 › &#155; &rsaquo; Single right-pointing angle
quotation mark
156 234 9C 10011100 œ &#156; &oelig; Latin small ligature oe
157 235 9D 10011101
158 236 9E 10011110 ž &#158; Latin small letter z with caron
159 237 9F 10011111 Ÿ &#159; &Yuml; Latin capital letter Y with diaeresis
160 240 A0 10100000 &#160; &nbsp; Non-breaking space
161 241 A1 10100001 ¡ &#161; &iexcl; Inverted exclamation mark
162 242 A2 10100010 ¢ &#162; &cent; Cent sign
163 243 A3 10100011 £ &#163; &pound; Pound sign
164 244 A4 10100100 ¤ &#164; &curren; Currency sign
165 245 A5 10100101 ¥ &#165; &yen; Yen sign
166 246 A6 10100110 ¦ &#166; &brvbar; Pipe, Broken vertical bar
167 247 A7 10100111 § &#167; &sect; Section sign
168 250 A8 10101000 ¨ &#168; &uml; Spacing diaeresis - umlaut
169 251 A9 10101001 © &#169; &copy; Copyright sign
170 252 AA 10101010 ª &#170; &ordf; Feminine ordinal indicator
171 253 AB 10101011 « &#171; &laquo; Left double angle quotes
172 254 AC 10101100 ¬ &#172; &not; Not sign
173 255 AD 10101101 &#173; &shy; Soft hyphen
174 256 AE 10101110 ® &#174; &reg; Registered trade mark sign
175 257 AF 10101111 ¯ &#175; &macr; Spacing macron - overline
176 260 B0 10110000 ° &#176; &deg; Degree sign
177 261 B1 10110001 ± &#177; &plusmn; Plus-or-minus sign
178 262 B2 10110010 ² &#178; &sup2; Superscript two - squared
179 263 B3 10110011 ³ &#179; &sup3; Superscript three - cubed
180 264 B4 10110100 ´ &#180; &acute; Acute accent - spacing acute
181 265 B5 10110101 µ &#181; &micro; Micro sign
182 266 B6 10110110 ¶ &#182; &para; Pilcrow sign - paragraph sign
183 267 B7 10110111 · &#183; &middot; Middle dot - Georgian comma
184 270 B8 10111000 ¸ &#184; &cedil; Spacing cedilla
185 271 B9 10111001 ¹ &#185; &sup1; Superscript one

Page 96 of 99
Symb HTML HTML
DEC OCT HEX BIN ol Number Name Description
186 272 BA 10111010 º &#186; &ordm; Masculine ordinal indicator
187 273 BB 10111011 » &#187; &raquo; Right double angle quotes
188 274 BC 10111100 ¼ &#188; &frac14; Fraction one quarter
189 275 BD 10111101 ½ &#189; &frac12; Fraction one half
190 276 BE 10111110 ¾ &#190; &frac34; Fraction three quarters
191 277 BF 10111111 ¿ &#191; &iquest; Inverted question mark
192 300 C0 11000000 À &#192; &Agrave; Latin capital letter A with grave
193 301 C1 11000001 Á &#193; &Aacute; Latin capital letter A with acute
194 302 C2 11000010 Â &#194; &Acirc; Latin capital letter A with
circumflex
195 303 C3 11000011 Ã &#195; &Atilde; Latin capital letter A with tilde
196 304 C4 11000100 Ä &#196; &Auml; Latin capital letter A with
diaeresis
197 305 C5 11000101 Å &#197; &Aring; Latin capital letter A with ring
above
198 306 C6 11000110 Æ &#198; &AElig; Latin capital letter AE
199 307 C7 11000111 Ç &#199; &Ccedil; Latin capital letter C with cedilla
200 310 C8 11001000 È &#200; &Egrave; Latin capital letter E with grave
201 311 C9 11001001 É &#201; &Eacute; Latin capital letter E with acute
202 312 CA 11001010 Ê &#202; &Ecirc; Latin capital letter E with
circumflex
203 313 CB 11001011 Ë &#203; &Euml; Latin capital letter E with diaeresis
204 314 CC 11001100 Ì &#204; &Igrave; Latin capital letter I with grave
205 315 CD 11001101 Í &#205; &Iacute; Latin capital letter I with acute
206 316 CE 11001110 Î &#206; &Icirc; Latin capital letter I with
circumflex
207 317 CF 11001111 Ï &#207; &Iuml; Latin capital letter I with diaeresis
208 320 D0 11010000 Ð &#208; &ETH; Latin capital letter ETH
209 321 D1 11010001 Ñ &#209; &Ntilde; Latin capital letter N with tilde
210 322 D2 11010010 Ò &#210; &Ograve; Latin capital letter O with grave
211 323 D3 11010011 Ó &#211; &Oacute; Latin capital letter O with acute
212 324 D4 11010100 Ô &#212; &Ocirc; Latin capital letter O with
circumflex
213 325 D5 11010101 Õ &#213; &Otilde; Latin capital letter O with tilde

Page 97 of 99
Symb HTML HTML
DEC OCT HEX BIN ol Number Name Description
214 326 D6 11010110 Ö &#214; &Ouml; Latin capital letter O with
diaeresis
215 327 D7 11010111 × &#215; &times; Multiplication sign
216 330 D8 11011000 Ø &#216; &Oslash; Latin capital letter O with slash
217 331 D9 11011001 Ù &#217; &Ugrave; Latin capital letter U with grave
218 332 DA 11011010 Ú &#218; &Uacute; Latin capital letter U with acute
219 333 DB 11011011 Û &#219; &Ucirc; Latin capital letter U with
circumflex
220 334 DC 11011100 Ü &#220; &Uuml; Latin capital letter U with
diaeresis
221 335 DD 11011101 Ý &#221; &Yacute; Latin capital letter Y with acute
222 336 DE 11011110 Þ &#222; &THORN; Latin capital letter THORN
223 337 DF 11011111 ß &#223; &szlig; Latin small letter sharp s - ess-zed
224 340 E0 11100000 à &#224; &agrave; Latin small letter a with grave
225 341 E1 11100001 á &#225; &aacute; Latin small letter a with acute
226 342 E2 11100010 â &#226; &acirc; Latin small letter a with circumflex
227 343 E3 11100011 ã &#227; &atilde; Latin small letter a with tilde
228 344 E4 11100100 ä &#228; &auml; Latin small letter a with diaeresis
229 345 E5 11100101 å &#229; &aring; Latin small letter a with ring
above
230 346 E6 11100110 æ &#230; &aelig; Latin small letter ae
231 347 E7 11100111 ç &#231; &ccedil; Latin small letter c with cedilla
232 350 E8 11101000 è &#232; &egrave; Latin small letter e with grave
233 351 E9 11101001 é &#233; &eacute; Latin small letter e with acute
234 352 EA 11101010 ê &#234; &ecirc; Latin small letter e with circumflex
235 353 EB 11101011 ë &#235; &euml; Latin small letter e with diaeresis
236 354 EC 11101100 ì &#236; &igrave; Latin small letter i with grave
237 355 ED 11101101 í &#237; &iacute; Latin small letter i with acute
238 356 EE 11101110 î &#238; &icirc; Latin small letter i with circumflex
239 357 EF 11101111 ï &#239; &iuml; Latin small letter i with diaeresis
240 360 F0 11110000 ð &#240; &eth; Latin small letter eth
241 361 F1 11110001 ñ &#241; &ntilde; Latin small letter n with tilde
242 362 F2 11110010 ò &#242; &ograve; Latin small letter o with grave
243 363 F3 11110011 ó &#243; &oacute; Latin small letter o with acute

Page 98 of 99
Symb HTML HTML
DEC OCT HEX BIN ol Number Name Description
244 364 F4 11110100 ô &#244; &ocirc; Latin small letter o with circumflex
245 365 F5 11110101 õ &#245; &otilde; Latin small letter o with tilde
246 366 F6 11110110 ö &#246; &ouml; Latin small letter o with diaeresis
247 367 F7 11110111 ÷ &#247; &divide; Division sign
248 370 F8 11111000 ø &#248; &oslash; Latin small letter o with slash
249 371 F9 11111001 ù &#249; &ugrave; Latin small letter u with grave
250 372 FA 11111010 ú &#250; &uacute; Latin small letter u with acute
251 373 FB 11111011 û &#251; &ucirc; Latin small letter u with circumflex
252 374 FC 11111100 ü &#252; &uuml; Latin small letter u with diaeresis
253 375 FD 11111101 ý &#253; &yacute; Latin small letter y with acute
254 376 FE 11111110 þ &#254; &thorn; Latin small letter thorn
255 377 FF 11111111 ÿ &#255; &yuml; Latin small letter y with diaeresis

Page 99 of 99

You might also like