U1) An Introduction To Core Java Flashcards
(26 cards)
Who developed Java and when?
James Gosling in 1995 at Sun Microsystems.
What was Java originally called?
Oak.
What is the main feature of Java?
Write Once, Run Anywhere (WORA).
List key features of Java.
Platform Independent, Object-Oriented, Simple, Secure, Robust, Multithreaded, Portable, High Performance, Distributed, Dynamic.
How does Java ensure security?
Bytecode verification, Security Manager, sandboxing, and no direct memory access.
How do you run a Java program using the command line?
Compile with ‘javac FileName.java’, run with ‘java FileName’.
How do you create and run a Java program in an IDE?
Create new project, add class, write code, and run using IDE buttons.
What are basic programming constructs in Java?
Decision-making (if, else, switch), looping (for, while, do-while).
What is a class in Java?
A blueprint for creating objects.
What is an object in Java?
An instance of a class.
What is a constructor in Java?
A special method used to initialize objects.
Define encapsulation.
Wrapping data and code into a single unit (class).
Define abstraction.
Hiding internal details and showing functionality only.
Define inheritance.
One class acquires the properties of another using ‘extends’.
Define polymorphism.
The ability of one method to behave differently in different situations.
How to use ‘super’ keyword?
To access parent class methods or constructor.
How to use ‘this’ keyword?
Refers to the current class object.
What does the ‘final’ keyword do?
Prevents method overriding or class inheritance.
What is an interface in Java?
A reference type with abstract methods to be implemented by classes.
How to implement an interface?
Use ‘implements’ keyword in the class definition.
What is a package in Java?
A namespace that organizes a set of related classes and interfaces.
How do you import a package?
Use ‘import packageName.ClassName;’ statement.
What is exception handling?
Managing runtime errors using try-catch-finally blocks.
What is the purpose of try-catch?
To catch and handle exceptions at runtime.