Module 1 - Introduction to Java Flashcards
Is an object-oriented programming language developed by James Gosling and colleagues at Sun Microsystems in the early 1990s
Java
Java is intended to be compiled to a _____, which is then run (generally using JIT compilation) by a Java Virtual Machine
Bytecode
Who, where and when is Java developed?
James Gosling; Sun Microsystems; early 1990s
Java was started as a project called _____ by James Gosling in _____.
Oak; June 1991
The first public implementation in 1995
Java 1.0
Java 1.0 made the promise of _____, with free runtimes on popular platform.
Write Once, Run Anywhere
The major web browsers soon incorporated Java 1.0 into their standard configurations in a secure _____ configuration.
Applet
New versions for large and small platforms (J2EE and J2ME) soon were designed with the advent of _____.
Java 2
Sun has not announced any plans for a _____.
Java 3
When was Sun reached out to the ISO/IEC JTCI and then Ecma International to formalize Java, but they quickly withdrew.
1997
Java continues to be a _____ standard regulated by the _____.
de facto proprietary; Java Community Process
With the revenue generated by new vision such as the _____, Sun made several Java implementations free of charge.
Java Enterprise Framework
The critical difference is that the compiler is not present in the _____, which differentiates between its Software Development Kit (SDK) and JRE (JRE).
JRE
When was Sun launched a considerable amount of Java in the GNU General Public License as free and open-source software (GPL).
November 13, 2006
When was Sun completed the process by releasing a fully accessible, all free and open-source Java’s core code, except for a small portion of the code that Sun did not copyright.
May 8, 2007
The 5 Primary Objectives of the Development of Java Language
- The object-oriented approach should be employed
- It should allow multiple operating systems to run the same program
- It should have built-in computer network support
- It should be configured to execute code from distant sources safely
- By selecting which parts of the other object-oriented languages are considered acceptable. It should be simple to use
- Refers to a method of programming and language design
- Idea is to design software so that the various types of data it manipulates are combined together with their relevant operations
Object Orientation (OO)
Data and code are combined into entities called _____
Objects
An _____ can be thought of as self-contained bundle of _____ (code) and _____ (data).
object; behavior; state
What is the principle of Object Orientation (OO)?
To make large software projects easier to manage, thus improving quality and reducing the number of failed projects
Object Orientation develop more generic objects so that software can become more _____ between projects.
reusable
Software objects can hopefully be seen more as _____ components, helping the software industry build projects largely from existing and well-tested pieces, thus leading to a massive reduction in development times.
pluggable
Programs written in the Java language must run similarly on diverse hardware.
Platform Independence
The code is run on a _____, a program written in native code on the host hardware that interprets and executes generic Java _____.
Virtual Machine (VM); bytecode
Java bytecode is interpreted or converted to native machine instructions by the _____.
JIT Compiler
In some languages the programmer allocates memory to create any object stored on the heap and is responsible for later manually deallocating that memory to delete any such objects.
Problem in Memory Management
The programmer determines when objects are created, and the Java runtime is responsible for managing the object’s lifecycle.
Java Automatic Garbage Collection (Avoidance of the Problem)
What are the 7 Benefits of Java?
- Java is used in networking
- Java is dynamic
- Java is reliable
- Java is simple
- Java is secure
- Java is portable
- Java is free
The Java language has many classes to facilitate Internet communications. Java classes can be loaded in most browsers to facilitate secure transactions over the Internet.
Java is used in networking
Java makes it possible to reuse previously written programs to lessen the workload of a programmer.
Java is dynamic
Java is _____ because it excludes some components that are error-prone. It also provides a way for programmers to anticipate and handle errors in their program.
Java is reliable
The Java programming language was designed to make OOP easier. Once you understand how components in a program are treated as objects, you will find Java fairly simple.
Java is simple
Java ensures that a program can go only where it was designed to go. It eliminates the possibility of altering system data unintentionally.
Java is secure
Java codes have the filename extension .java. When compiled, a class file with .class extension is created. This file can then run on any machine which has the Java Virtual Machine, thus, making it portable.
Java is portable
Java codes have the filename extension _____. When compiled, a class file with _____ extension is created. This file can then run on any machine which has the _____, thus, making it portable.
.java; .class; Java Virtual Machine
Java ensures that a program can go only where it was designed to go. It eliminates the possibility of altering system data unintentionally.
Java is free
- Bundles all the tools you need to write, debug, and test your code
- Allows developers to work in a single environment and improve their programming workflow
IDE or Integrated Development Environment
What are the 5 Essential Java IDE Tools?
- Debugging
- Syntax Highlighting
- Build Automation
- Code Completion
- Graphical User Interface (GUI)
While debuggers vary among different IDEs, it’s important to have a tool to highlight potential errors and help you step through your code.
Debugging
Built-in highlighting is crucial for readability and efficiency. This tool can help you find errors in your code and allows you to sift through your code at a quicker speed.
Syntax Highlighting
A good IDE will allow you to write and run your Java code in the same window, increasing the productivity and efficiency of your program.
Build Automation
This tool identifies and inserts code components to save you time and lower the risk of typos and bugs.
Code Completion
Enables an intuitive programming interface
Graphical User Interface (GUI)
What are the 7 Popular Java IDEs?
- Eclipse
- NetBeans
- IntelliJ IDEA
- BlueJ
- Oracle JDeveloper
- MyEclipse
- JCreator
It’s free, open-source, and has an extensive plugin ecosystem that allows users to customize functionalities for application development.
Eclipse
Is the official IDE for Java 8, making it a top Java IDE for creating
desktop, mobile, and web applications applications. It is open-source and is used to develop desktop, web, and mobile applications along with HTML5 and C++.
NetBeans
It’s a capable and ergonomic IDE, with features to boost productivity without cluttering the user interface. It includes a set of tools that make programming easier, like smart completion, cross-language refactoring, data flow analysis, and language injection.
IntelliJ IDEA
Two Editions of IntelliJ
- Community Edition
2. Ultimate Edition
IntelliJ edition that is free and open-source, with a focus on Android and Java Virtual Machine (JVM) development.
Community Edition
IntelliJ edition that is paid, with a focus on web and enterprise development.
Ultimate Edition
Was originally created for educational content but is now used on a smaller scale for software development. While it is a great Java IDE for beginners, many Java veterans opt to use it because of its interactive and clutter-free user interface.
BlueJ
Is a freeware IDE offered by Oracle. It includes features for application development in Java, PHP, SQL, XML, HTML, and JavaScript. It covers the entire development lifecycle: coding, designing, debugging, optimizing, profiling, and deploying.
Oracle JDeveloper
Is a proprietary Java IDE that is built upon the Eclipse platform. It uses both proprietary and open-source code in the development environment, and its tools can be used for Java application development and web development. It offers support for Angular, HTML, TypeScript, and JavaScript.
MyEclipse
Is a powerful and lightweight Java IDE written in C++, which makes it faster than other Java IDEs. It has an interface similar to that of Microsoft’s Visual Studio making source code navigation easier. It can handle various JDK profiles for multiple projects and offers strong API guidelines for developers. It’s a great option for beginners because of its intuitive user interface.
JCreator
Use case: You’re a multi-language developer looking for an IDE that offers an extensive plugin environment and don’t mind taking the time to customize your experience.
Eclipse
Cross-platform: Windows, Mac OS, Linux, Solaris.
Eclipse, NetBeans
Use case: You’re a multi-language developer looking for a ready-to-go IDE with developer collaboration tools and Maven support.
NetBeans
Cross-platform: Linux, Mac OS, Windows, Solaris
NetBeans
Use case: You’re a developer whose company will pay for an IDE and who’s looking for an intuitive IDE that’s easy to use out of the box. You also have a fast computer that can handle a heavier IDE.
IntelliJ IDEA
Cross-platform: Linux, Mac OS, Windows
IntelliJ IDEA
Use case: You’re newer to Java development and want more practice creating simple projects in an intuitive, lightweight environment
BlueJ
Cross-platform: Windows, Linux, Mac OS.
BlueJ
Use case: You’re an experienced Java developer looking for a wide set of tools and have a computer that can run a heavy program.
Oracle JDeveloper
Cross-platform: Windows, Linux, Mac OS
Oracle JDeveloper
Use case: You’re familiar with Eclipse, and your company will pay for an IDE. You also have a fast computer to handle a heavy IDE.
MyEclipse
Cross-platform: Linux, Mac OS, Windows
MyEclipse, IntelliJ IDEA, BlueJ, Oracle JDeveloper,
Use case: You’re a Windows user who’s looking for a fast IDE with a clean interface and you’re willing to pay for it.
JCreator
Not cross-platform: Windows
JCreator
Was conceived to model real world objects
Object-Oriented Programming (OOP)
In OOP, a _____ defines the _____ and _____ of a set of _____. An _____ is an instance of a _____.
class; common variables (attributes); methods (functions); objects; object; class
Is a blueprint or prototype from which objects are created
Class
Java _____ keyword is an access modifier. The access modifier is accessible everywhere. So, we can easily access it inside and outside the class and package.
public
Every line of code that runs in Java must be inside a _____
class
A class should always start with an _____
Uppercase First Letter
The _____ must match the _____.
Name of the Java File; Class Name
Indicates the start of a block
Curly Brace ({)
What is the symbol for Multiple Line Comments?
Starts with /* and ends with */
- Is something used to document a part of a code
- It is not part of the program itself, but used for documentation purposes.
- It is a good programming practice to add it to your code
- Ignored and NOT executed by the program.
Comment
Indicates the name of one method in Hello class which is the main method
public static void main(String[] args) {
Is the starting point of a Java program
Main Method
All programs except _____ written in Java start with the main method
Applets
Is used for single line comment
Two Backslash Character (//)
Is used to display messages to the command window
System.out.println
The last two lines which contains the _____ is used to close the main method and class respectively.
Two Curly Braces
} //end of main
} // end of class
Is used to declare a class in Java
class keyword
Is an access modifier that represents visibility. It means it is visible to all.
public keyword
If we declare any method as _____, it is known as the _____. The core advantage of the (2nd answer) is that there is no need to create an object to invoke the (2nd answer).
static keyword; static method
Is executed by the JVM, so it doesn’t require creating an object to invoke it. So, it saves memory.
main() method
Is the return type of the method. It means it doesn’t return any value.
void
Represents the starting point of the program.
main
Is used for command line argument.
String[] args or String args[]
Is used to print statement.
System.out.println()
System is a _____, out is an _____ of the PrintStream class, _____ is a method of the PrintStream class.
class; object; println()
Errors are usually typing errors
Syntax Errors Syntax
– Misspelled a command in Java
– Forgot to write a semi-colon at the end of a statement
Common Syntax Errors
Compiler Error Message: class PrinHello is public, should be declared in a file named PrintHello.java
Solution: check the filename with the class name class PrinHello vs. PrintHello.java
Change the class name to match the File name.
Compiler Error Message: reached end of file while parsing
Solution: check the delimiter { } pairing.
Ensure that each { is paired with }
Compiler Error Message: cannot find symbol class string
Solution: Change string to String, it might be that string is in lower case.
Compiler Error Message: package system does not exist
Solution: system should be in Upper case. Change to System.
Compiler Error Message: cannot find symbol method printIn(java.lang.String)
Solution: Change printIn to println; its print LN NOT print IN
Compiler Error Message: unclosed string literal
Solution: check if the “ has a pair.
Compiler Error Message: ‘;’ expected
Solution: place a ; at the end of the statement
Errors that will not display until you run or execute your program
Runtime Errors
Your Java programs should always end with the _____
.java extension
Filenames should match the name of your _____.
public class
You should write _____ in your code explaining what a certain class does, or what a certain method does.
Comments
– These are notes written to a code for documentation purposes.
– Those texts are not part of the program and does not affect the flow of the program.
Java Comments
- // symbol denotes a single line.
- Comments is written per line
Single Line Comment
You can also create _____ by starting the line with /* and ending it with */ .
Multiple Line Comments
What programming language was Java’s successor?
C/C++ Programming
Who is the Author of Java language?
James Gosling
What is the original name of Java language?
Oak
What type of Java program can be run inside a Java supported Web browser?
Applet
Which company owns Java at present?
Oracle
What software runs a Java program in a computer?
Java Runtime Environment (JRE)
What is the output file of a Java compiled program?
.class file
When was the first version of Java (i.e. Java 1.0) release?
1995
What type of programming language is Java?
Object-Oriented Programming
What does JIT in Java means?
Just-In-Time
What is the correct header line for Java program?
public static void main(String[] args) {
or
public static void main(String args[]) {
What does a single line comment look like in Java?
//comment
Program statements in Java must end with
semi colon (;)
What is an example of multi-line comment?
/* The beginning of a multi-line the end of the multi-line */
What do you call the curly braces found at the starting of the program and end of the program?
Delimiter