KEMBAR78
Week 6 8 Introduction To Java 1 | PDF | Java (Programming Language) | Java Virtual Machine
0% found this document useful (0 votes)
11 views5 pages

Week 6 8 Introduction To Java 1

Uploaded by

Xanika.ggyhf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Week 6 8 Introduction To Java 1

Uploaded by

Xanika.ggyhf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to Java

I. Brief History of Java


The history of Java is very interesting. Java was originally designed for interactive television, but it was
too advanced technology for the digital cable television industry at the time. The history of Java starts with
the Green Team. Java team members (also known as Green Team), initiated this project to develop a
language for digital devices such as set-top boxes, televisions, etc. However, it was best suited for internet
programming. Later, Java technology was incorporated by Netscape. The principles for creating Java
programming were "Simple, Robust, Portable, Platform-independent, Secured, High Performance,
Multithreaded, Architecture Neutral, Object-Oriented, Interpreted, and Dynamic". Java was developed by
James Gosling, who is known as the father of Java, in 1995. James Gosling and his team members started
the project in the early '90s.

Currently, Java is used in internet programming, mobile devices, games, e-business solutions, etc.
Following are given significant points that describe the history of Java.

1. James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June
1991. The small team of sun engineers called Green Team.
2. Initially it was designed for small, embedded systems in electronic appliances like set-top boxes.
3. 3) Firstly, it was called "Greentalk" by James Gosling, and the file extension was .gt.
4. 4) After that, it was called Oak and was developed as a part of the Green project.
5. 5) Why Oak? Oak is a symbol of strength and chosen as a national tree of many countries like the
U.S.A., France, Germany, Romania, etc.
6. 6) In 1995, Oak was renamed as "Java" because it was already a trademark by Oak Technologies.
Why Java Programming named "Java"?
7. Why had they chose the name Java for Java language? The team gathered to choose a new name. The
suggested words were "dynamic", "revolutionary", "Silk", "jolt", "DNA", etc. They wanted something
that reflected the essence of the technology: revolutionary, dynamic, lively, cool, unique, and easy to
spell, and fun to say. According to James Gosling, "Java was one of the top choices along with Silk".
Since Java was so unique, most of the team members preferred Java than other names.
8. Java is an island in Indonesia where the first coffee was produced (called Java coffee). It is a kind of
espresso bean. Java name was chosen by James Gosling while having a cup of coffee nearby his office.
9. Notice that Java is just a name, not an acronym.
10. Initially developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle
Corporation) and released in 1995.
11. In 1995, Time magazine called Java one of the Ten Best Products of 1995.
12. JDK 1.0 was released on January 23, 1996. After the first release of Java, there have been many
additional features added to the language. Now Java is being used in Windows applications, Web
applications, enterprise applications, mobile applications, cards, etc. Each new version adds new
features in Java.

Introduction to Java Page 1 of 5


II. Java Technology
 Has a variety of features
 Is both a programming language and a platform

Java Technology can…


 Be a Programming Language – designed to operate at high levels by utilizing English-like
commands/instructions as opposed to low-level, binary machine code.
 Be a Development Environment – provides a large collection of tools such as compilers,
interpreters, and file packaging tools, etc.
 Use Technology Applications – typically general-purpose programs that can run on any machine
where deployment environments with the Java Runtime Environment (JRE) are installed.

III. Advantages of Using Java


 Object-Oriented – To function within complex environments, Java offers an object-based
development platform using its tools and features.
 Portable and Platform Independent – Via platform-neutrality (programs developed in Java can
run on any computer system), Java can run on any system by using a special file format called
bytecodes that is executed by any computer system that has a Java interpreter.
 Dynamically Linked – Codes are linked at runtime; sections of an application are linked in as
needed, reducing the need for all classes to be present.
 Multithreaded – Programs can contain multiple threads of execution, allowing several tasks to be
handled simultaneously, reducing operation times.
 Garbage-Collected – Java contains its own garbage-collection feature for memory management;
programs are not required to delete objects allocated in memory.

IV. The Java Development Process

 Determine the target output; it can be a string of text, an array of values, or a simple interface.
 Determine the input needed to produce the output; coded input can be from a text editor or a Java-
based program file ending with the .java extension for use of a Java compiler.
 Use appropriate procedures to convert the input into output; procedures correspond to the javac
compiler, compiling the program into .class files.
 If errors occur during compilation, the Java programmer can debug them at runtime.
 If no errors were found, a .class file is generated in bytecode and is the one actually executed.
 The Java launcher tool then runs the program with an instance of the JVM; JVM is available on
many different platforms, so .class files can be run on any version of any operating system.

V. What You Can Do with Java


 Applets are programs that adhere to certain conventions allowing it to be run within any Java-
enabled web browser; an applet can be embedded within a webpage for personalization.
 Applications are stand-alone programs that run directly on the Java platform to meet specific needs,
such as automated inventory systems, payroll management system, library information system etc.

Introduction to Java Page 2 of 5


Syntax and Grammar
 What is syntax?
 Rules for combining words into statements.
 Must be correctly followed in order for a program to understand what it must do.
 What is grammar?
 Rules for interpreting the meaning of statements.
 Allows programs to properly execute the code according to how it was designed.

Sample Program: Implementing Syntax and Semantics

public class syntaxandsemantics


{
public static void main(String []args)
{
System.out.println("Hello ICT 1");
System.out.println("This program is intended for getting the sum of 2
integers");
int num1 = 10;
int num2 = 20;
int sum = num1 + num2;
System.out.println("The sum is: " + sum);

}
}

Output:
Hello ICT 1
This program is intended for getting the sum of 2 integers
The sum is: 30

Classes
 Considered the “blueprint” containing everything that a program must contain in order for it to function
properly.
 Used by programming languages like Java to “build” programs from the methods that are contained in
them.

public class helloWorld


{
public static void main (String[] args)
{
//This block prints out “Hello, World!”
System.out.println(“Hello, World!”);
}
}

Statements
 Specify actions performed during a program’s execution (such as mathematical computations, expressions
or printing of text).
 Contain the parts necessary for a class.
 Can also contain comments, which describe what a statement is doing; comments prove very useful
in explaining which part of the program does which task, avoiding confusion

Introduction to Java Page 3 of 5


public class javaStatements
{
public static void main(String []args)
{
System.out.println("Hello ICT 1");
System.out.println("This program is intended for getting the sum of 2
integers");
int num1 = 10;
int num2 = 20;
int sum = num1 + num2;
System.out.println("The sum is: " + sum);

//This is an example of Java Single-line comment

/*
While this is
an example of
a block comment in Java
*/
}
}

Identifiers
 Used to label variables, statements, classes, and other parts of a program.
 Serve as the way for a program to identify its tasks, methods, and even the data it uses for its execution.

Common Guidelines When Using Identifiers


 Identifiers are case-sensitive.
 They may contain letters, digits, underscore and the dollar sign($), but may not start with digits.
 They may NOT use Java keywords.
 They should be named according to function.
 Method and variable names start in lowercase while classes start in uppercase.
 Multi-word identifiers use underscores to separate words, or capitalize the first letter of each word
 They should not start with underscores.

public class javaIdentifiers


{
public static void main(String []args)
{
System.out.println("Hello ICT 1");
System.out.println("This program is intended for getting the sum of 2
integers");
int num1 = 10;
int num2 = 20;
int sum = num1 + num2;
System.out.println("The sum is: " + sum);
}
}
VALID INVALID
Student
pieMaster
pie_Master 4pie
pieMaster pie-pie
pie4 “pie,pie”
pie2pie pie/cake
dollar$man void
$dollarman
pieMethod

Introduction to Java Page 4 of 5


Keywords
 Also called reserved words.
 Words used exclusively by Java in order to implement its features.
 Represent components for a Java program in order for it to execute properly in a Java-enabled environment.
abstract extends new do true
boolean false null double while
break final package else try
byte finally private interface void
byvalue float protected super long
case for public switch native
catch goto import synchronized else
char if instanceof return this
class implements int short threadsafe
const continue default static throw
Literals
 Denotes a constant/fix value in a program; its value does not change no matter which part of the program
it is used.
 Can be used across different methods and classes, if these methods and classes require the use of that
constant value.
 Useful for values used in mathematical expressions, general template statements for printouts, and print
statements that ask for input.
Types of Literals
 Integer Literals denote digits that are whole numbers; these digits can have different bases, such as
octal and hexadecimal bases.
 Floating-Point Literals denote digits that denote digits that contain a fractional or decimal part,
or are not whole numbers.
 Character Literals denote single characters, such as letters, punctuation marks that are not
keywords, and even special characters; character literals always have single values.
 Boolean Literals can only be denoted by true or false. They are usually used to denote a state of a
conditionally satisfied statement.
 String Literals denote sentences or phrases that require more than a single character.

public class Implement_Literals


{
public static void main(String []args)
{
String firstName = "Juan";
String lastName = "Dela Cruz";
int age = 16;
double grade = 85.50;

System.out.println("Welcome " + lastName + ", " + firstName + " in Computer


Programming");
System.out.println(firstName + " " + lastName + " is " + age + " years old");
System.out.println(firstName + " " + lastName + " grade is " + grade);
}
}
Output:
Welcome Dela Cruz, Juan in Computer Programming
Juan Dela Cruz is 16 years old
Juan Dela Cruz grade is 85.50

References:
https://www.javatpoint.com/history-of-java
https://www.geeksforgeeks.org/the-complete-history-of-java-programming-language/

Introduction to Java Page 5 of 5

You might also like