Java 1 Environment

Ace your homework & exams now with Quizwiz!

Three

How many ways can you overload a method? In order to overload a method, the argument lists of the methods must differ in either of these: 1. Number of parameters.For example: This is a valid case of overloading add(int, int) add(int, int, int) 2. Data type of parameters.For example: add(int, int) add(int, float) 3. Sequence of Data type of parameters.For example: add(int, float) add(float, int)

Valid

Is this a Valid/Invalid overloading? add(int a, int b) add(int a. float b) Note: only parameter type or sequence should make it unique. Name of parameters doesn't make it unique.

Invalid

Is this a Valid/Invalid overloading? add(int a, int b) add(int c. int d) Note: only parameter type or sequence should make it unique. Name of parameters doesn't make it unique.

True

JVM is Java Virtual Machine. On development machine, it is part of Java Development Kit (JDK). True or False?

True

JVM is Java Virtual Machine. On production machine it is part of Java Runtime Environment (JRE). True or False?

Java Development Kit

JVM- JDK needed in development environment stands for:

Java Runtime Environment

JVM-JRE needed in production environment stands for:

C

Java platform is: A- Java VM B-Java API C- Both And B together

False

Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different. It is similar to constructor overloading in Java, that allows a class to have more than one constructor having different argument lists. True of False: add(int a, int b) and add(int a, int c) an example of method overloading? Note: the param type is same. The parameter types or numbers are not different.

True

Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different. It is similar to constructor overloading in Java, that allows a class to have more than one constructor having different argument lists. True of False: add(int, int) and add(int, int, int) an example of method overloading?

Architecture Neutral

Name the Java Characteristics: -Java code runs same way regardless of the hardware architecture. It runs same way on Windows as it does in a Unix or Lynux hardware. This is possible as java class code is bytecode and not binary code. Java source code is compiled into architecture-independent bytecode. The bytecode is interpreted by a Java Virtual Machine (JVM) on the target architecture. JVM uses just in time (JIT) compiler to generate binary instructions. Bytecode is very optimized and because of JIT is very efficient.

Object Oriented Programming

Name the Java Characteristics: -Java provides the basic object technology of C++ with some enhancements and some deletions. Every class represents an object. Classes can inherit from other classes.

Distributed

Name the Java Characteristics: A system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another. The components interact with one another in order to achieve a common goal. http. ftp, URL, TCP (Transport control protocol) are different ways one computer talks to another. Java also uses RMI (Remote method invocation)

Portable

Name the Java Characteristics: Java code can run on any architecture and on any OS. You have to compile .java files only once. It can be deployed on any of your friend's OS as long as Java Virtual Machine (Java Runtime Environment) is installed. This is possible as java class code is bytecode and not binary code. Java source code is compiled into architecture-independent bytecode. The bytecode is interpreted by a Java Virtual Machine (JVM) on the target architecture. JVM uses just in time (JIT) compiler to generate binary instructions. Bytecode is very optimized and because of JIT is very efficient.

Secure

Name the following Java Characteristics: - Java ensures that bytecode doesn't perform any illegal access to OS. Java compiler generates the bytecode from .java file .The bytecode is not the machine code (binary code) , it contains the certain symbols of java programming language.And it is this bytecode which travel form one computer to another computer not the machine code. JVM, java virtual machine creates the machine code from this bytecode .So the machine code of java program never save on any operating system ,program carry the bytecode only . Java is secure because of this bytecode. Bytecode is loaded in memory.Then it verified by bytecode verifier. The bytecode verifier filter the bytecode and check there should not be any extra code(bugs).This makes java secure. This is possible as java class code is bytecode and not machine code (AKA, binary code). Java source code is compiled into architecture-independent bytecode. The bytecode is interpreted by a Java Virtual Machine (JVM) on the target architecture. JVM uses just in time (JIT) compiler to generate binary instructions. Bytecode is very optimized and because of JIT is very efficient.

High Performance

Name the following Java characteristics: - JVM uses JIT (Just in time) compiler which generates machine code. -Bytecode is also very optimized. Both of the above result in High Performance of Java code.

Dynamic

Name the following Java characteristics: - Java links invoked modules during runtime time. Small fragments of bytecode may be dynamically updated on a running system.

Multithreaded

Name the following Java characteristics: - Java program can do many things simultaneously in parallel. A user may be loading a page and another user can simultaneously load the same page.

Robust

Name the following Java characteristics: - is the ability of a computer system to cope with errors during execution and cope with erroneous input. Both the Java compiler and the Java interpreter provide extensive error checking. Java manages all dynamic memory, checks array bounds, and other exceptions.

Production Environment

The machine where .class code is run using JRE (Java Runtime Environment) is called? The users are actual ends user.

QA

The machine where .class code is run using JRE (Java Runtime Environment) is called? The users are test users.

Development Environment

The machine where .java code is developed using JDK (Java Development Kit) and and IDE (like Netbeans, Eclipse) is called:

True

True or False jar -cvf SwingEmailSender.jar -C build\classes . will create an archive file SwingEmailSender.jar. It will compress all files in location build\classes subdirectory. It will put SwingEmailSender.jar in current directory. -C specifies root directory path where classes are . means put output jar in current directory. -cvf means copy, verbose, force

True

True or False jar -xvf SwingEmailSender.jar will extract all files from the java archive. -xvf means extract, verbose, force -x means extract

JAVA_HOME, PATH, CLASSPATH

Write three environment variables you need in windows java environment: PATH=%JAVA_HOME%\bin CLASSPATH is set to root package and libraries.

B

executable program "java" is used for: A-compiling .java to .class (bytecode) B-run/interpret .class file

A

executable program "javac" is used for: A-compiling .java to .class (bytecode) B-run .class file

Method Overloading

in a class when you use same method name but different combination of arguments then it is an example of? Like add(int, int) add(int, float) add(int, float, float)

Method Overriding

in a subclass when you change implementation of same method signature (as in parent class or an interface) is example of?

Polymorphism

is defined as when subclass have their own individual behavior as well as many characteristics of the parent class and interfaces. Basically it is inheritance from a parent class with added unique behavior (method).

jar

-this command is considered java archiving or compression tool.

Simple

Name the following Java characteristics: - Java is easy to learn. It is similar to C++, but with most of the more complex features of C and C++ removed. Like Pointers, Programmer Controlled Dynamic Memory Management are removed from Java.

True

True or False In windows development environments following environment variables need to be set: -JAVA_HOME -PATH -CLASSPATH

B

"java" is A-compiler, HLL (High Level Language) code to bytecode (.class) B-interpreter of byte code to machine code

A

"javac" is A-compiler, HLL (High Level Language) code to bytecode (.class) B-interpreter of byte code to machine code

Ploymorphism

-is basically inheritance where child class inherits behavior of parent class as well as it has its own unique behavior (methods)

javadoc

-this command allows you to create html pages associated with the api documentations. In general, comments are any multi-line comments ("/** ... */") that are placed before class, field, or method declarations. They must begin with a slash and two stars, and they can include special tags to describe characteristics like method parameters or return values. The HTML files generated will describe each field and method of a class, using the Javadoc comments in the source code itself. Examples of different Javadoc comments are listed below. /** * Changes the name of this Student. * This may involve a lengthy legal process. * @param newName This Student's new name. * Should include both first * and last name. */ public void setName(String newName) { name = newName; }

polymorphism

:means many forms

D

Which of the following is NOT considered a characteristics of a Java programming environment: A)Portable B)Object Oriented Programming (OOP) C)Multithreaded D)Programmer-controlled dynamic memory.

/

In Unix (Lynux) OS what is folder path separator?

:

In Unix(Lynux) CLASSPATH uses which character as delimiter?

;

In windows CLASSPATH uses which character as delimiter?

\

In windows OS what is folder path separator?

Static Polymorphism

Polymorphism in Java has two types: Compile time polymorphism (static binding) and Runtime polymorphism (dynamic binding). Method overloading is an example of static polymorphism, while method overriding is an example of dynamic polymorphism. Method over loading in a class (having different arguments of the same method names like add(int a, int b) and add(int a, int b, int c)) is an example of ?

Dynamic Polymorphism

Polymorphism in Java has two types: Compile time polymorphism (static binding) and Runtime polymorphism (dynamic binding). Method overloading is an example of static polymorphism, while method overriding is an example of dynamic polymorphism. Method overriding in a subclass (different implementation of the same parent method) is example of?

True

True or False javadoc is used as following and it generates html pages: $ javadoc AddNum.java Loading source file AddNum.java... Constructing Javadoc information... Standard Doclet version 1.7.0_51 Building tree for all the packages and classes... Generating /AddNum.html... AddNum.java:36: warning - @return tag cannot be used in method with void return type. Generating /package-frame.html... Generating /package-summary.html... Generating /package-tree.html... Generating /constant-values.html... Building index for all the packages and classes... Generating /overview-tree.html... Generating /index-all.html... Generating /deprecated-list.html... Building index for all classes... Generating /allclasses-frame.html... Generating /allclasses-noframe.html... Generating /index.html... Generating /help-doc.html... 1 warning $

True

True or False src -folder1 ----folder2 ------Class1.java -Test.java to compile Test.java in windows you will use follwong command javac Class1.java -CLASSPATH . Here . means current directory which is root (src) directory.

True

True or False? A class has members of two types: -Data Members -Method Members

True

True or False? Accessors are get methods. They do not change any value.

False

True or False? All methods of a class are called accessors ?

True

True or False? Java does not provide: -Programmer-controlled dynamic memory -Pointer arithmetic -struct -typedefs -#define

True

True or False? Method members, operators, behavior, are synonyms?

True

True or False? Mutators are set methods. They change the value of the data member. The name doesn't have to say set in its name. public void reset(); public setName(String name); Both are mutator methods.

True

True or False? Variables, Fields, Data members are synonyms?

High Level Language

What does HLL mean? Note: Java is HLL. It can be read by humans, like .java syntax or c++ syntax.

Low Level Language

What does LLL mean? Note: Binary (0, 1) instructions are LLL. A LLL is a programming language that provides little or no abstraction from a computer's instruction set. It is difficult to read by a human. Generally, this refers to either machine code or assembly language.

C

Which statement describes polymorphism within the java language? A) Polymorphic classes dynamically hold the methods and properties of other unique classes. B)Polymorphism is another name for a parent class or base class. C) Polymorphism is when subclass have their own individual behaviors as well as many characteristics of their respective parent classes. D)Polymorphism is a unique Java class that is created from another class.

D

Which statements are true: A) A class can extend (inherit) from one superclass only but it can implement multiple interfaces. A extends B implements C, D B)A class can extend (inherit) from many superclass and it can implement multiple interfaces. A extends B, C implements D, E C) A class can implement multiple interfaces A implements B, C, D D) A and C

A

What is the correct path: A-HLL(.java)-> bytecode (.class)->machine language binary B-HLL(.java)->machine language binary ->bytecode (.class) C-machine language binary->bytecode (.class)->HLL(.java)

Encapsulation

What is the name for following: Declare the variables of a class as private. Provide public setter and getter methods to modify and view the variables values.


Related study sets

All of the following statements are correct regarding credit life insurance EXCEPT Benefits are paid to the borrower's beneficiary. The amount of insurance permissible is limited per borrower. Premiums are usually paid by the borrower. Benefit

View Set

Nomenclatura compuestos inorgánicos

View Set

Protection Under Consumer Credit Laws

View Set

Corporate Citizenship: Social Responsibility, Responsiveness, and Performance

View Set