

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
JAVA PROGRAMMING| QUESTIONS WITH SOLUTIONS JAVA PROGRAMMING| QUESTIONS WITH SOLUTIONS
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Assign a Value - Answer-to set the data of a variable (involves the equal sign). Class - Answer-Describes a particular kind of object. It can contain related methods and variables. Double - Answer-A type of variable (or value) that can contain fractions as well as integers. Declaration - Answer-A statement that creates a variable, method, or class identifier and its associated attributes but doesn't necessarily allocate storage for variables or define an implementation for methods. int - Answer-An integer value String - Answer-Sequence of characters double - Answer-A real number(64 bytes) float - Answer-A real number(32 bytes) toUpperCase - Answer-This method converts a character to uppercase. toLowerCase - Answer-This method converts a character to lowercase. Algorithm - Answer-A set of steps that define a process for solving a specific problem. The main( ) Method - Answer-This gets your Java program running. There must be at least one such method among your classes. if/else - Answer-public static void main(String [ ] args){ int= if(age<=17){ System.out.println("You are too young") } else { System.out.println("You are old"); }
Method - Answer-Houses the program statements that perform its tasks. instantiation - Answer-Process of building an object of a class before a program can perform the tasks that the class' methods define. Method call - Answer-A command to execute another method, which causes all of the statements inside that method to be executed. Instance variables - Answer-A variable defined in a class for which each instantiated object of the class has a separate copy. Similar, but not equal to, a class variable. Inheritance - Answer-lets once class get all definitions from another for free void - Answer-Used to indicate that a method does not return a value, and instead represents a command static - Answer-Used to indicate that a method can be accessed without an object method syntax - Answer-modifier returnValueType methodName (parameters){ body= statements } void method - Answer-A method with void in place of the return type, which does not return a value when called Main Method Syntax - Answer-Public static void main(String[] args) { // code } local variable - Answer-a variable that is declared within a method, must be given a value before it's used and can't be used outside that method(=block of code) e.g. a parameter (can't be declared twice) Boolean data type - Answer-a variable that is either true or false Constructor syntax - Answer-access specifier(PUBLIC) name of class (list of parameters including data type) { constructor body; } immutable object - Answer-An object whose value cannot be changed. Math.PI - Answer-constant from math class that represents pi