0% found this document useful (0 votes)
7 views

Introduction to Java and BlueJ(1) (2)

The document provides an introduction to Java and BlueJ, explaining fundamental programming concepts such as if-else control structures, programs, programming languages, and the role of a programmer. It covers Java's features, including its applications, applets, classes, and key principles like abstraction, encapsulation, inheritance, and polymorphism. Additionally, it defines important terms such as tokens, identifiers, keywords, constants, variables, data types, and operators.

Uploaded by

ruqayyariyaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Introduction to Java and BlueJ(1) (2)

The document provides an introduction to Java and BlueJ, explaining fundamental programming concepts such as if-else control structures, programs, programming languages, and the role of a programmer. It covers Java's features, including its applications, applets, classes, and key principles like abstraction, encapsulation, inheritance, and polymorphism. Additionally, it defines important terms such as tokens, identifiers, keywords, constants, variables, data types, and operators.

Uploaded by

ruqayyariyaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to Java and BlueJ

29. Explain if - else control structure.

The if-else is a logical situation , where either of the two actions are to be performed depending on the
specific condition. If the condition evaluates to true then the statements written inside the body of the if
block are executed, otherwise the statements in the else block get executed.

1. What is a program?
Program is a set of instructions.

2. What is a programming language?


A programming language is a set of commands, instructions, and other syntax used to create a software
program.

3. Who is a programmer?
The person who creates these programs is known as a Programmer.

4. What is a source code?


A program written in a human readable form.

5. What is an Object code?


A program understandable by a machine.

6. What is a translator?
An interpreter or compiler is a translator, which translates the program written in high level language into
machine level language.

7. What is Java?
Java is an Object Oriented Programming Language developed in January 1996 by a team of Sun
Microsystems, headed by James Gosling.

8. How Java is useful?


Java is used in developing the following applications.
Desktop applications Business applications
Web based applications Cloud applications
Distributed applications Mobile applications
Gaming and animation Digital and electronic devices.

9. What is an applet?
An applet is a Java program that can be embedded into a web page. Applets are used to make the web site
more dynamic and entertaining.

10. What is BlueJ?


BlueJ is an IDE (Integrated Development Environment) for beginners to write, edit and execute the java
program.

11. What is an Object?


Objects are real world entities or items. It can be either non-living entities, such as pen, book, table, chair,
car, calculator, phone and computer or living entities like dog, cat and plant etc.

12. How a real world object is maintained in a software object?


Software object maintains its state in variables and behaviour in methods.

13. What is a class?


A class represents a group of objects of the same kind.
Eg: class : vehicle
All the vehicles have the same properties and common behavior.
They have wheels, power, engine are used for transportation

14. Define Abstraction.


Abstraction provides only the essential features of the system to the user and hides all the complex
processes.

15. Define encapsulation.


Encapsulation is the technique of binding both data and functions together, to keep them safe from
unauthorised access and misuse.

16. What is inheritance?


An object of one class acquires the properties and behavior of objects of another class.

17. What is the use of Polymorphism?


Polymorphism allows a function to behave differently for different objects.

18. What are tokens?


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.
Tokens can be put together to construct programs.

19. What is an identifier?


An identifier is any name, given to different components of a Java program.
Identifiers are used to denote
class name
method name and
variable name.

20. What are keywords?


Keywords are the reserved words of a Java program with some special meaning and can be used for that
purpose only.
Keywords cannot be used as identifiers..
Eg: public, void, class etc

21. What are constants?


Constants mean the fixed values that do not change during the execution of a program.
Eg: 5,78,922 etc
There are two types
Numeric constants: 12,100 etc
Character constants: 'A', '*', '6'
String constant: “SFX”, “India is my country”

22. What is a variable? How to declare and initialize a variable?


A variable is a named location in the memory, which stores data temporarily.
It can store one data at a time and can accept different values during the execution of the program.
Declaration of a variable
Each variable must be declared before it is used in a program. The variable declaration consists of two parts:
The data type of the variable and name of the variable.
Syntax: <datatype><variable name>
int age;
float percentage;

Initialization of a variable
Initialisation is a process of assigning some initial value to a variable.
int age=15;
float av=90.23;

23. What is a datatype?


A data type is a type of data. ... Some common data types include integers, floating point numbers,
characters, strings,
Some common datatype are
Type Datatype

Character char
Boolean boolean
Integer int
Fractional float
double

24. What are operators?


Operators are special symbols, that are used to perform calculations. Operators are applied to the variables
and constants to form an expression.
x=a+b;
in this example x,a,b are variables
=,+ are operators

25. What are Arithmetic operators?


Arithmetic operators are used to perform basic arithmetical operations, such as addition, subtraction,
multiplication and division etc.

26. What are Relational operators?


Relational operators are used to test the relation between two variables. A relational expression returns
either true or false (Boolean result)

You might also like