Final Flashcards
What is a constructor?
A constructor is a method that allows you to create objects from a class. You call the constructor by using the keyword new , followed by the name of the class, followed by any necessary parameters. Constructors are responsible for initializing the instance variables of the class.
How do you instantiate an object?
Instantiating an object consists of defining an object reference—which will hold the address of the object in memory—and calling a special method of the class called a constructor, which has the same name as the class.
What is default constructor?
A default constructor is a constructor which can be called with no arguments (either defined with an empty parameter list, or with default arguments provided for every parameter).
What is a “copy” constructor?
A copy constructor is a special constructor for creating a new object as a copy of an existing object.
What is an array?
An array is a sequence of variables with adjacent memory locations and of the same data type. The data type could be any primitive data type, such as int, float, double, byte, boolean, char, short, or long, or it could be a class.
How do you access elements of an array?
An element is accessed using the array name and a subscript, called an index, which refers to the element’s position in the array.
What is the difference between a Counter and an Accumulator?
Accumulators are used to keep a running total of numbers during successive passes through a loop, while a counter will be incremented by one and will be equal to the number of loop iterations
What is an overloaded constructor?
A method can be overloaded by defining another method with the same name but a different signature, that is, with a different number of parameters or with parameters of different data types.
What is the difference between a Static and a Non-Static method inJAVA language?
A “Static” method DOES NOT require instantiating an object to access it.A “Non Static” method requires instantiating an object to access it. Examples : Main and MATH methods
Describe the Program Development Cycle?
1) Design a solution to a problem (design a program)
2) Implement the solution (code the program )
3) Test the solution (test the program)
4) Fix the solution (debug the program)
What are the three basic operation in Boolean logic?
AND, OR, and NOT
What type of errors can you have?
SYNTAX ERRORS – Violations of the programming language rules.
LOGIC ERRORS – Also called run-time or execution errors.
They are errors in the sequence of the instructions in the
program.
What is instantiation?
The act of creating a new instance of an object.
What are variables?
Variables are memory locations used to store data.
What are parameters?
Parameters are values that are passed to another method when it is invoked by an event.