Sie sind auf Seite 1von 9

Java

Java is a programming language offering many features that make it attractive


for mathematical illustration. First, it is a high-level language providing a
wealth of constructs, yet at the same time it is relatively simple to use so that,
after mastering a few concepts, you may begin writing useful code quickly. It
was designed with graphics in mind and now supports powerful graphical tools
similiar to those found in PostScript. Also important is that Java code runs and,
at least in theory, behaves in the same way on every platform. Combined with
its compatibility with networking and the Internet, this makes Java a powerful
tool for publishing illustrations. The first thing to know is that Java is an object-
oriented language. This provides the programmer with a natural way to divide
programs into smaller, reusable pieces, called objects, thus making it easier to
manage, debug and expand the code. If you have no experience with object-
oriented languages, this will likely require the greatest adjustment in your
thinking. At the same time, it is one of the nicest features of Java: you will
likely find that it provides a natural, elegant way to construct programs and
ultimately it will allow you to develop code more efficiently. Java’s syntax is
similar to the programming language C, and those with experience with C
generally find it relatively easy to read Java code. In fact, C++ is something of a
middle ground between C and Java as it adds object-oriented features to C.
However, Java is different from these languages in that it adopts the object-
oriented model more fully; loosely said, everything is an object in Java. This
first chapter is meant to be an introduction to programming in Java. In
particular, you’ll see how to create and run Java programs and build a few
programs of your own. The next chapter will explain object-oriented
programming. Like most programming languages, Java is best learned by
actively writing programs and these notes aim to get you to that point quickly. I

1
prefer at the beginning not to explain every detail that you will see in the
examples. Instead, we will borrow some existing code, modify it by focusing on
smaller pieces and only later go back to consider the big picture. This is likely
the same way in which most people learn TEX.

Object Oriented Programming

Object-oriented programming is a method of implementation in which programs


are organized as cooperative collections of objects, each of which represents an
instance of some class, and whose classes are all members of one or more
hierarchy of classes united via inheritance relationships. An object can be
considered a "thing" that can perform a set of related activities. The set of
activities that the object performs defines the object's behavior. For example,
the Hand (object) can grip something, or a Student(object) can give their name
or address.The first step in OOP is to identify all the objects the programmer
wants to manipulate and how they relate to each other, an exercise often known
as data modeling. Once an object has been identified, it is generalized as a class
of objects (think of Plato's concept of the "ideal" chair that stands for all chairs)
which defines the kind of data it contains and any logic sequences that can
manipulate it. Each distinct logic sequence is known as a method. Objects
communicate with well-defined interfaces called messages.

The concepts and rules used in object-oriented programming provide these


important benefits:

 The concept of a data class makes it possible to define subclasses of data


objects that share some or all of the main class characteristics.

2
Called inheritance, this property of OOP forces a more thorough data
analysis, reduces development time, and ensures more accurate coding.

 Since a class defines only the data it needs to be concerned with, when an
instance of that class (an object) is run, the code will not be able to
accidentally access other program data. This characteristic of data
hiding provides greater system security and avoids unintended data
corruption.

 The definition of a class is reuseable not only by the program for which it is
initially created but also by other object-oriented programs (and, for this
reason, can be more easily distributed for use in networks).

 The concept of data classes allows a programmer to create any new data type
that is not already defined in the language itself.

Simula was the first object-oriented programming


language. Java, Python, C++, Visual Basic .NET and Ruby are the most popular
OOP languages today. The Java programming language is designed especially
for use in distributed applications on corporate networks and the Internet. Ruby
is used in many Web applications. Curl, Smalltalk, Delphi and Eiffel are also
examples of object-oriented programming languages.

3
James Gosling

James Gosling has a great deal of his life invested in Java. He is considered the
father of the programming language, which was launched by Sun in 1995 and
runs on billions of digital devices, and is currently at the center of a contentious
legal battle between Oracle and Google.Up until Saturday night -- when he
wrote that "Google totally slimed Sun" -- the proud father of Java had been
fairly moderate in his comments about how Google treated his baby.When the
lawsuit, claiming that Google had infringed on Java copyrights and patents in its
Android platform, was announced by Oracle back on August 10, 2010,
Gosling suggested on his personal blog that Java's new owner might be inclined
to take a different approach to dealing with Google and Android than was the
case at Sun Microsystems: A few days later, on August 15, 2010, Gosling
wrote a longer post, citing "very weak notions of interoperability" with Android
that Sun "strongly objected to." He concluded his post by calling the lawsuit
"more about ego, money and power."

Gosling left Oracle with some acrimony in April 2010, less than three months
after the enterprise software giant closed its deal to acquire Sun for $7.4 billion.
In announcing his departure, Gosling wrote, "Just about anything I could say
that would be accurate and honest would do more harm than good."

4
History of Java

Java is a programming language created by James Gosling from Sun


Microsystems (Sun) in 1991. The target of Java is to write a program once and
then run this program on multiple operating systems. The first publicly available
version of Java (Java 1.0) was released in 1995. Sun Microsystems was acquired
by the Oracle Corporation in 2010. Oracle has now the steermanship for Java. In
2006 Sun started to make Java available under the GNU General Public License
(GPL). Oracle continues this project called OpenJDK.

Over time new enhanced versions of Java have been released. The current version
of Java is Java 1.8 which is also known as Java 8.

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 Java language was designed with the following properties:

 Platform independent: Java programs use the Java virtual machine as


abstraction and do not access the operating system directly. This makes Java
programs highly portable. A Java program (which is standard-compliant and
follows certain rules) can run unmodified on all supported platforms, e.g.,
Windows or Linux.

5
 Object-orientated programming language: Except the primitive data types, all
elements in Java are objects.

 Strongly-typed programming language: Java is strongly-typed, e.g., the types


of the used variables must be pre-defined and conversion to other objects is
relatively strict, e.g., must be done in most cases by the programmer.

 Interpreted and compiled language: Java source code is transferred into the
bytecode format which does not depend on the target platform. These
bytecode instructions will be interpreted by the Java Virtual machine (JVM).
The JVM contains a so called Hotspot-Compiler which translates performance
critical bytecode instructions into native code instructions.

 Automatic memory management: Java manages the memory allocation and


de-allocation for creating new objects. The program does not have direct
access to the memory. The so-called garbage collector automatically deletes
objects to which no active pointer exists.

The Java syntax is similar to C++. Java is case-sensitive, e.g., variables


called myValue andmyvalue are treated as different variables.

Java Platform Editions

• A Java Platform is the set of APIs, class libraries, and other programs used
in developing Java programs for specific applications.

There are 3 Java Platform Editions:

1. Java 2 Platform, Standard Edition (J2SE)

6
• Core Java Platform targeting applications running on workstations .

2. Java 2 Platform, Enterprise Edition (J2EE)

• Component-based approach to developing distributed, multi-tier enterprise


applications.

3. Java 2 Platform, Micro Edition (J2ME)

• Targeted at small, stand-alone or connectable consumer and embedded


devices.

A Simple Java Program

//This program prints Welcome to Java!

public class Welcome

public static void main(String[] args)

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

7
Conclusion

Java has significant advantages not only as a commercial language but also as a
teaching language. It allows students to learn object-oriented programming
without exposing them to the complexity of C++. It provides the kind of
rigorous compile-time error checking typically associated with Pascal. It allows
instructors to introduce students to GUI programming, networking, threads, and
other important concepts used in modern-day software.

Java might well be a language that most computer science departments could
agree to use as an introductory language. If so, we'll all benefit from once again
having a single dominant language in CS1.

8
Literature

https://www.quora.com/ [JAN.2017]

http://www.webopedia.com/

http://www.vogella.com/JavaIntroduction/

https://www.scribd.com/

Das könnte Ihnen auch gefallen