Leo P. answered 08/19/23
Professional Java tutor for the University of Central Florida
C and C++ are single-threaded languages whereas Java is a multi-threaded language.
Three reasons an alive thread might not be Runnable are that it is blocked, waiting, and sleeping.
A thread enters a Dead state when it completes its execution.
A thread’s priority can be changed with method setPriority().
A thread may give up the processor to a thread of the same priority by calling Thread method yield().
Ultimately, all data items processed by a computer are reduced to combinations of 0s and 1s.
A group of related files is called a database.
RandomAccessFile method readInt() reads an integer from the specified stream.
True or False:
9. True. A thread is not Runnable if it is dead.
False. System.in, System.out, and System.err are automatically created.
True. Methods "seek" must seek relative to the beginning of a file.
Review:
What are the four main parts of a class?
Attributes/Fields: These define the state of the object.
Methods/Functions: These define the behavior of the object.
Constructor: Special method used for initializing newly created objects.
Inner classes & interfaces (optional): Classes & interfaces defined within a class.
How do you change a private variable within a class?
Through setter methods or inside the class methods where it's accessible.
What is the difference between private, protected, and public access modifiers?
private: The member is accessible only within its own class.
protected: The member is accessible within its own package and by subclasses.
public: The member is accessible from any other class.
What is the difference between a class and an array?
Class: A blueprint for creating objects (a particular data structure), containing variables and methods to describe the object's behavior.
Array: A data structure that can hold more than one value at a time. It is a collection of variables that are accessed with an index.
How do you declare an array in Java?
dataType[] arrayName; or dataType arrayName[];
Example: int[] myArray; or int myArray[];
I hope this helps! If you have any other questions or need clarification on any points, let me know.