INTRODUCTION TO JAVA & BLUEJ
A. Fill in the blanks:
1. Object Oriented Programming 2. State, Behaviour 3. Class 4. void Token
B. State True or False:
1. True 2. True 3. False 4. True 5. False 6. True 7. False 8. True
C. Application Based Questions:
2. Arithmetic Operator
D. Multiple Choice Questions:
1. (c) Variable 2. (b) Object Oriented Programming
3. (c) Identifiers 4. (b) Bytecode 5. (a) Unary Operator
E. Answer in one word:
1. Keywords 2. // 3. Character constant 4. boolean 5. Relational operator
F. Answer the following:
A. Objects are real world entities or items. It can be either non-living entities, such as pen, book, table, chair, car, scooter, calculator, phone, and computer or living entities, like do cat, and plant, etc. Every object is defined through its attributes and For example, a pen as an object has its attributes, such as brand name, model, colour, price, etc. Its behaviour (function) is writing.
A. A class represents a group of objects of the same kind. A class may be regarded blueprint to create objects. It defines data and functions common to all objects of certain kind. A class consists of two aspects, variables and functions. The variables for the state of an object and the functions of a class use these variables to perform various operations.
A. BlueJ is an IDE (Integrated Development Environment) for beginners to write, edit and execute Java programs. It allows students to write programs using an interactive visual environment, which gives them a good understanding of programming concept. BlueJ includes:
· An editor, which you use to write your programs.
· A debugger, to help you find your mistakes.
· A viewer, to see the parts of your program.
· An easy way to run Java programs.
· An easy way to view documentation.
A. Constants mean the values that do not change during program's execution. These values can be digits or characters. For example: 12,-22.5,7.5, "BIueJ", "KIPS".
A variable is a named location in the memory, which stores data temporarily. A variable has a unique name, a type, and a size, which is used to identify it in a program. It can hold one data at a time and can accept different values during the execution of the program. For example: areaofcircle = n * rad2 The variable 'rad' will store the previous value of radius until we assign it a new value.
A. Operators are special symbols, which are used to perform calculations. Operators are applied to the variables and constants to form an expression.
A. The main data types in Java are as follows:
int float double char boolean
A. Java compiler converts the source code into a format that is neither dependent on a machine nor a platform. We call this new code as the Bytecode further this bytecode is converted into an executable machine code for particular platform by JVM (Java Virtual Machine) using the corresponding interpreter. The Java interpreter works by taking each line of bytecode, translating it into machine language and executing it. This feature makes the Java, a platform independent language.
A. The smallest meaningful element of a Java program is called a token. Tokens define the structure of the Java language. The tokens are the basic building blocks, which can be put together to construct programs.
A. The Java program is made up of the following parts:
commnets: The text within slash asterisk (/*... ... */) or after double slash(//) is treated as a comment and is ignored by a computer.
Class Declarataion: The'class' keyword declares the program's name.
Main: This is the place from where program's execution begins when the class is executed.
Public: The keyword public indicates that the method can be called from anywhere inside or outside the class.
Void: The void is a Java keyword which signifies that the function will not return any result except the text that we enter in the Print statements.
String args: Represents the arguments or parameters passed to the class at the time of execution.
System.out.println: This statement is used to print any message or result on the terminal screen.