Uploaded by Leah Grabillo

LESSON 3 - Java Programming

advertisement
LESSON 3: Intro to Java Programming
Java language was developed by Sun Microsystems in
1995. In subsequent years, the language has become
the backbone of millions of applications across
multiple platforms including Windows, Macintosh and
UNIX-based desktops, Android-based
mobiles,
embedded systems and enterprise solutions. Java was
started as a project called "Oak“by a team led by
James Gosling in June 1991. Gosling's goals were to
implement a virtual machine and a language that had
a familiar C like notation but with greater uniformity
and simplicity than C/C++.
Java is defined by a specification and consists of a
programming language, a compiler, core libraries and
a runtime (Java virtual machine) The Java runtime
allows software developers to write program code in
other languages than the Java programming language
which still runs on the Java virtual machine. The Java
platform is usually associated with the Java virtual
machine and the Java core libraries. The target of Java
is to write a program once and then run this program
on multiple operating systems.
Features of Java
1. Simple - Java is easy to learn and its syntax is quite
simple, clean and easy to understand. The confusing
and ambiguous concepts of C++ are either left out in
Java or they have been re-implemented in a cleaner
way. According to Sun, Java language is a simple
programming language because:
•
Java syntax is based on C++ (so easier for
programmers to learn it after C++).
•
Java has removed many complicated and
rarely-used features, for example, explicit
pointers, operator overloading, etc.
•
There is no need to remove unreferenced
objects because there is an Automatic Garbage
Collection in Java.
2. Secure - When it comes to security, Java is always
the first choice. With java secure features it enables us
to develop virus free, temper free system. Java
program always runs in Java runtime environment
with almost null interaction with system OS, hence it
is more secure. Java is best known for its security.
With Java, we can develop virus-free systems. Java is
secured because:
• No explicit pointer
Java Programs run inside a virtual machine
sandbox
3. Portable - Java is portable because it facilitates you
to carry the Java bytecode to any platform. It doesn't
require any implementation.
4. High Performance - Java is an interpreted
language, so it will never be as fast as a compiled
language like C or C++. Java enables high
performance with the use of just-in-time compiler.
Java code is compiled into bytecode which is highly
optimized by the Java compiler, so that the Java
virtual machine (JVM) can execute Java applications
at full speed.
5. Multithreaded - The Java platform is designed
with multithreading capabilities built into the
language. That means you can build applications
with many concurrent threads of activity, resulting
in highly interactive and responsive applications. A
thread is like a separate program, executing
concurrently. We can write Java programs that deal
with many tasks at once by defining multiple
threads. The main advantage of multi-threading is
that it doesn't occupy memory for each thread. It
shares a common memory area. Threads are
important for multi-media, Web applications, etc.
6. Architecture-neutral - Java is architecture
neutral because there are no implementation
dependent features, for example, the size of primitive
types is fixed. Compiler generates bytecodes, which
have nothing to do with a particular computer
architecture, hence a Java program is easy to
interpret on any machine.
7. Robust - Robust simply means strong. Java is
robust because:
•
•
•
•
It uses strong memory management.
There is a lack of pointers that avoids security
problems.
There is automatic garbage collection in java
which runs on the Java Virtual Machine to get
rid of objects which are not being used by a
Java application anymore.
There are exception handling and the type
checking mechanism in Java. All these points
make Java robust.
8. Distributed - Java is distributed because it
facilitates users to create distributed applications in
Java. This feature of Java makes us able to access
files by calling the methods from any machine on the
internet.
9. Dynamic - Java is a dynamic language. It
supports dynamic loading of classes. It means
classes are loaded on demand. It also supports
functions from its native languages, i.e., C and C++.
Java supports dynamic compilation and automatic
memory management (garbage collection).
10. Platform-independent - Java is platform
independent because it is different from other
languages like C, C++, etc. which are compiled into
platform specific machines while Java is a write once,
run anywhere language. A platform is the hardware
or software environment in which a program runs.
Java code can be run on multiple platforms, for
example, Windows, Linux, Sun Solaris, Mac/OS, etc.
Java code is compiled by the compiler and converted
into bytecode. This bytecode is a platformindependent code because it can be run on multiple
platforms, i.e., Write Once and Run
Anywhere (WORA).
11. Object-oriented - Java is an object-oriented
programming language. Everything in Java is an
object. Object-oriented means we organize our
software as a combination of different types of objects
that incorporates both data and behavior. Objectoriented programming (OOPs) is a methodology that
simplifies software development and maintenance by
providing some rules.
Basic concepts of OOPs are:
1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation
QUIZ # 3
DIRECTIONS: Answer the following questions
carefully and choose the letter of the correct
answer.
1. These are intended to Display the web page of the
current URL available at the server.
a. Web Browsers
b. Index
c. Search Engines
d. Crawl
2. These are the examples of the Search Engines,
EXCEPT?
a. Google
b. Amazon c. Bing
d. Netscape
3. It is the process in which search engines send out a
team of robots to find new updated content.
a. Ranking
b. Indexing
c. Crawling
d. Searching
4. This is one of the main characteristics of the Web
browser.
a. It contains own database
b. It consists of Graphical User Interface
c. It is used to find information in the World Wide Web
d. It is intended to gather Information regarding
several URL’s and to maintain it.
5. It is also called an “answer machine”.
a. Search Engines
b. Web browsers
c. World Wide Web
d. URL
6. What is the World Wide Web?
A) a computer game
B) a software program
C) another name for the Internet
D) a part of the Internet that enables informationsharing via interconnected pages
7. Which is the best search tool for finding Web sites?
A) library
B) search engines
C) subject directories D) discussion groups
8. Which of the following is NOT needed in using
search engine?
A) browser
B) internet connection
C) social media account D) computer or mobile phone
9. Which description does NOT apply to the Internet?
A) a vast network that connects millions of computers
around the world
B) a public network neither owned nor run by any one
group or individual
C) a catalog of information organized and factchecked by a governing body
D) an interconnected system of networks that allows
for communication through e-mail and the World Wide
Web
10. Which one of the following is a search engine?
A) Google
B) Netscape
C) Macromedia Flash
D) Librarians’ Index to the
Internet 11. Which of the following is a TRUE
statement? A) Web sources must be cited in your
report. You are not free to plagiarize.
B) You are free to copy information you find and
include it in a report.
C) You do not have to cite the Web sources you use in
your research report.
D) You should never consult Web sources when you
are doing a research report.
12. What is a URL?
A) a type of UFO
B) a computer software program
C) an acronym for Unlimited Resources for Learning
D) the address of a document or "page" on the World
Wide Web
13. Why are search engines important?
A) They sort through information; kind of like a library
card catalog.
B) Makes it easier to find information rather than
linking to it yourself.
C) You can narrow your search down to the exact
information you need with a search engine.
D) All of the above.
14. Which of the following is a true statement about
the Internet and the library? They both:
A) close after hours.
B) provide up-to-the-minute news.
C) provide access to newspapers, magazines, and
journals.
D) have an expert librarian or specialist to answer your
questions. http://www.classzone.com is an example
of what?
A) a URL
C) a directory
B) a server
D) an access code
II. Let us identify the parts of a search engine
homepage using the activity below.
Write the words below on the Google homepage:
• web address (URL) • backward button • address bar
• search bar
• close button • minimize button • add new tab
• maximize button • a link • forward button
1. _________________
2. _________________
3. _________________
4. _________________
5. _________________
6. _________________
7. _________________
8. _________________
9. _________________
10. _________________
III.
Download