What are the features (characteristics) of Java?

Features of Java:

1. Platform independent: An important feature of Java is Platform independent. A program written in java can be executed on different platforms without any changes. Because of this portability feature Java is a popular language for internet.

2. Compiled and interpreted language: Java is a both a compiled and interpreted language. The program written in Java is first translated by java compiler into Byte code. After that the java interpreter converts the byte code into machine code which can be executed on machine.

3. Object oriented programming: Java is an object oriented language. Java supports all object oriented programming features like abstraction, encapsulation, data hiding, message passing etc.

4. Robust and secure. Java provides automatic garbage collection which automatically removes unused objects. It also supports exception handling which handles errors (exceptions) at the run time. Java provides security by ensuring that applets cannot access the local system.

5. Simple and easy to learn: Java is a simple and easy to learn as it is quite similar to C and C++ languages. Java does not support those features of C or C++ which affects the security of code. For e.g., Java does not use goto statement, pointers, operator overloading and multiple inheritance.

6. Automatic memory management: Java provides automatic garbage collection which automatically deletes an unused object and deallocates memory allocated to that object.

7. Multithreaded: Java supports Multithreading. Multithreading is a technique by which the programmer can execute multiple sub processes concurrently (at the same time). In others words, Multithreading means executing multiple parts of a program.

What is a Platform Independent Language?

Platform Independent Language means that a computer program written in the language can run without any changes on different platforms or different kinds of operating systems like Windows, LINUX, and UNIX etc. JAVA is a Platform Independent Language because of its Byte Code.

What is JAVA?

Java programming language was invented by a team under the guidance of “James Gosling” at Sun Microsystems in 1995. Java is a Platform independent language. Java is used for internet applications, mobile applications and consumer devices. Java is platform independent language because of its byte code which can be executed by JVM (Java Virtual Machine). Java is both a compiled and interpreted language because program written in JAVA is first converted into Byte Code (Intermediate Code) by Java compiler which is then executed by Java Interpreter.

What are the Branching Statements?

Branching statements are used to shift the control of the program from one part within the program to another part.

Types of Branching Statements:
1. Break statement
2. Continue statement
3. Goto statement

What are the different types of arguments?

Types of Arguments:

1. Actual Arguments: Actual arguments are the values of the variables that send at the time when functions are called.
2. Formal Arguments: Formal arguments are the variables in which the values of actual arguments that are send during function call are collected.

What is a Recursive function?

Recursion is the process of defining a function which calls itself from within its body. Recursive function is a function which calls itself again and again till the condition which is specified is true. In recursive functions we must give the terminating condition that is the limit upto which a function calls itself otherwise it will become an infinite loop that is a loop that never ends.
Eg of recursion : Program to calculate factorial of a number using recursion
# include
int factorial(int n)
{
if(n <= 1) return 1; else return n*factorial(n - 1); } void main() { int x = 5; printf("factorial of %d is %d",x,factorial(x)); }

What is Compile Time and Run Time?

Compile time is the time during which the compiler checks the errors of the program and trace out (display) errors if any. Compiling of a program is done using Alt+F9 in C and C++.

Run time (Execution time) is the time during which the compiler executes (runs) the program. Compiler executes the .exe file of program which is created after all the errors are removed. Execution of a program is done using Ctrl+F9 in C and C++.

What are the different types of Constants?

Types of Constants:
1. String constants: String constants consist of alphanumeric characters within double quotes. Eg:”abc123”,”sachin”.
2. Integer constants: Integer constants are those which are used to store whole numbers that is numbers without decimal points. E.g.: 100,10,7 etc.
3. Character constants: Character constants are those which used to store characters are represented within single quotes. It may be a character, alphabet, single digit. E.g.: ‘7’, ‘i’ etc.
4. Boolean constants: Boolean constants represent only two values true or false.
5. Floating point constants (Real Constants): Floating point constants are used to store numbers having decimal points or i.e. real numbers. E.g.: 9.125, 7.356.

What is variable and constant?

Variables are used to store the values depending upon its data type. We can change the value of the variable at any time during the execution of a program.

Constants are those whose values remain same and cannot be changed at run time. There are three types of Constants:
1. String constants
2. Numeric constants
3. Character constants

What is an Identifier?

Identifier is the name given to the variable, function, array, structure etc.

There are certain rules which an identifier must follow:
1. It should not be a keyword which is available in the language.
2. First character of identifier should be an alphabet or underscore.
3. No other special character is allowed except underscore (_).
4. Both the cases that are upper case and lower case are allowed. An identifier student is not same as STUDENT.