Lesson 1: Introduction To The Java Language Flashcards
Who invented java، what company، year، and what was it originally called?
Java was conceived by James Gosling (lead)، Patrick Naughton، Chris Warth، Ed Frank، and Mike Sheridan at Sun Microsystems in 1991. This language was initially called “Oak” but was renamed “Java” in 1995.
What was the original purpose of Java? Why?
The primary motivation was the need for a platform-independent language that could be used to create software to be embedded in various consumer electronic devices، such as toasters، microwave ovens، and remote controls. The trouble was that (at the time) most computer languages were designed to be compiled into machine code that was targeted for a specific type of CPU.
What cause was secondary but more important in the development of popularity in Java programming?
About the time that the details of Java were being worked out، a second، and ultimately more important، factor emerged that would play a crucial role in the future of Java. This second force was، of course، the World Wide Web.
In laymans terms، what are portable programs?
portable (platform-independent) programs
What two coding languages does java descend from?
The two languages that form Java’s closest ancestors are C and C++
What does Java inherit from C and what in C++? Why is it’s close tie with these two languages so important in it’s popularity development?
From C، Java inherits its syntax. Java’s object model is adapted from C++. Java’s relationship to C and C++ is important for a number of reasons. First، at the time of Java’s creation، many programmers were familiar with the C/C++ syntax. Because Java uses a similar syntax، it was relatively easy for a C/C++ programmer to learn Java. This made it possible for Java to be readily utilized by the pool of existing programmers، thus facilitating Java’s acceptance by the programming community
Why is Java not the internet version of C++?
Java is not simply the “Internet version of C++.” Java has significant practical and philosophical differences from C++. Furthermore، Java is not an enhanced version of C++. For example، it is neither upwardly nor downwardly compatible with C++. Moreover، Java was not designed to replace C++. Java was designed to solve a certain set of problems. C++ was designed to solve a different set of problems. They will coexist for many years to come.
How did Java simplify web-based programming?
Java simplified web-based programming in a number of ways. Arguably the most important is found in its ability to create portable، cross-platform programs. Of nearly equal importance is Java’s support for networking. Its library of ready-to-use functionality enabled programmers to easily write programs that accessed or made use of the Internet. It also provided mechanisms that enabled programs to be readily delivered over the Internet.
What are applets and what is their key feature?
An applet is a special kind of Java program that is designed to be transmitted over the Internet and automatically executed inside a Java-compatible web browser. If the user clicks a link that contains an applet، the applet will download and run in the browser automatically. Applets were intended to be small programs، typically used to display data provided by the server، handle user input، or provide simple functions، such as a loan calculator. The key feature of applets is that they execute locally، rather than on the server. In essence، the applet allowed some functionality to be moved from the server to the client.
What two broad object categories can transmitted between server and client? Where do applets fit in?
In general، there are two very broad categories of objects that are transmitted between the server and the client: passive information and dynamic active programs. For example، when you read your e-mail، you are viewing passive data. Even when you download a program، the program’s code is still only passive data until you execute it. By contrast، the applet is a dynamic، self-executing program.
How does C# relate to java?
A few years after the creation of Java، Microsoft developed the C# language. This is important because C# is closely related to Java. In fact، many of C#’s features directly parallel Java. Both Java and C# share the same general C++-style syntax، support distributed programming، and utilize a similar object model. There are، of course، differences between Java and C#، but the overall “look and feel” of these languages is very similar.
In layman’s terms، how is Java safe if its programs self-execute?
Java achieved protection by enabling you to confine an application to the Java execution environment and prevent it from accessing other parts of the computer.
What are bytecode، JVM، and JRE and how do they work together?
Bytecode is a highly optimized set of instructions designed to be executed by what is called the Java Virtual Machine (JVM)، which is part of the Java Runtime Environment (JRE). In essence، the original JVM was designed as an interpreter for bytecode.
What is the sandbox?
Because the JVM is in control، it manages program execution. Thus، it is possible for the JVM to create a restricted execution environment، called the sandbox، that contains the program، preventing unrestricted access to the machine.
Why is Java not slower than other compilers running executable code?
When a program is interpreted، it generally runs slower than the same program would run if compiled to executable code. However، with Java، the differential between the two is not so great. Because bytecode has been highly optimized، the use of bytecode enables the JVM to execute programs much faster than you might expect.
What is the HotSpot JVM and what is a JIT compiler?
there is nothing about Java that prevents on-the-fly compilation of bytecode into native code in order to boost performance. For this reason، the HotSpot JVM was introduced not long after Java’s initial release. HotSpot includes a just-in-time (JIT) compiler for bytecode. When a JIT compiler is part of the JVM، selected portions of bytecode are compiled into executable code in real time on a piece-by-piece demand basis. That is، a JIT compiler compiles code as it is needed during execution. Furthermore، not all sequences of bytecode are compiled—only those that will benefit from compilation.
What are Java servlets?
A Java servlet is a small program that executes on a server. Servlets dynamically extend the functionality of a web server. It is helpful to understand that as useful as client-side applications can be، they are just one half of the client/server equation. Not long after the initial release of Java، it became obvious that Java would also be useful on the server side.
Why are applets not viable? What JDK started it’s replacement and which one fully replaced it?
Applets rely on a Java browser plug-in. Thus، for an applet to work، it must be supported by the browser. Simply put، without browser support، applets are not viable. Because of this، beginning with JDK 9، the phase-out of applets was begun، with support for applets being deprecated. In the language of Java، deprecated means that a feature is still available but flagged as obsolete. Thus، a deprecated feature should not be used for new code. The phase-out became complete with the release of JDK 11 because support for applets was removed.
What is Java Web Start and how is it different than an applet?
Called Java Web Start، it enabled an application to be dynamically downloaded from a web page. It was a deployment mechanism that was especially useful for larger Java applications that were not appropriate for applets. The difference between an applet and a Web Start application is that a Web Start application runs on its own، not inside the browser. Beginning with JDK 11، support for Java Web Start has been removed.
What tool was deployed in JDK 9 and replaces applets and Java Web Start?
Given that neither applets nor Java Web Start are viable options for modern versions of Java، you might wonder what mechanism should be used to deploy a Java application. At the time of this writing، one part of the answer is to use the jlink tool added by JDK 9. It can create a complete run-time image that includes all necessary support for your program، including the JRE.
What are major Java releases called and what does increased release cadence allow?
Each major release، now called a feature release، will include those features ready at the time of the release. This increased release cadence enables new features and enhancements to be available to Java programmers in a timely fashion. Furthermore، it allows Java to respond quickly to the demands of an ever-changing programming environment.
What decade was structured programming popularized like C and Pascal? What characterizes a structured language?
The 1960s gave birth to structured programming. This is the method encouraged by languages such as C and Pascal. Structured languages are characterized by their support for stand-alone subroutines، local variables، rich control constructs، and their lack of reliance upon the GOTO.
In a very general sense، how can a program be classified based on its organization? How does oop factor into this?
In the most general sense، a program can be organized in one of two ways: around its code (what is happening) or around its data (what is being affected). Using only structured programming techniques، programs are typically organized around code. This approach can be thought of as “code acting on data.” Object-oriented programs work the other way around. They are organized around data، with the key principle being “data controlling access to code.” In an object-oriented language، you define the data and the routines that are permitted to act on that data. Thus، a data type defines precisely what sort of operations can be applied to that data.
What three traits do all OOP languages have in common?
All OOP languages، including Java، have three traits in common: encapsulation، polymorphism، and inheritance.
What is encapsulation، a black box، and how do these work to make an object?
Encapsulation is a programming mechanism that binds together code and the data it manipulates، and that keeps both safe from outside interference and misuse. In an object-oriented language، code and data can be bound together in such a way that a self-contained black box is created. Within the box are all necessary data and code. When code and data are Page 11linked together in this fashion، an object is created.
What does it mean to have private and public data in an object? When are they used?
Within an object، code، data، or both may be private to that object or public. Private code or data is known to and accessible by only another part of the object. That is، private code or data cannot be accessed by a piece of the program that exists outside the object. When code or data is public، other parts of your program can access it even though it is defined within an object. Typically، the public parts of an object are used to provide a controlled interface to the private elements of the object.