bt0074 unit 2 faqs

Upload: sreilal

Post on 06-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Bt0074 Unit 2 Faqs

    1/1

    Frequently Asked Questions

    1

    Subject Name: OOPS with Java Subject Code: BT0074

    Unit 2: Java BasicsBalasubramani R

    Assistant ProfessorDept. of ITQ1: What do you mean by Java keywords?

    A1: Keywords are special words that are of significance to the Java compiler. There are 48

    reserved keywords currently defined in the Java language. These keywords combined

    with the syntax of the operators and separators, form the definition of the Java language.

    These keywords cannot be used as names for a variable, class, or method.

    Q2: How do Java programs run?

    A2: The concept of write once, run anywhere is possible in Java. The Java program can be

    compiled on any platform having a Java compiler. The resulting bytecode can then be run

    on any machine. The machine should have a Java platform to run Java code. Javaplatform consists of Java Virtual Machine (JVM) and a package known as Java

    Application Programming Interface (Java API).

    Q3: What are the various primitive data types in Java?

    A3: Primitive data types are the data types that are built into the Java language. The Java

    compiler holds detailed instructions on each legal operation the data type supports. There

    are eight primitive data types in Java: byte, short, int, long, float, double, char, and

    boolean.

    Q4: What do you mean by abstract data types in Java?A4: Abstract data types are based on primitive data types and have more functionality than

    the primitive data types. For example, String is an abstract data type that can store

    alphabets, digits, and other special characters like /,();:$#. You cannot perform

    calculations on a variable of the String data type even if the data stored in it has digits.

    Q5: List out the rules for naming variables in Java.

    A5: A Java variable name:

    Must not be a keyword in Java.

    Must not begin with a digit.

    Must not contain embedded spaces.

    Can contain characters from various alphabets like Japanese, Greek, and Cyrillic.