The document contains 11 multiple choice questions and 11 short answer questions about Java programming concepts. The multiple choice questions cover topics like abstract classes, data structures, object visibility, exceptions, EJBs, and Java features. The short answer questions ask about differences between J2EE and J2SE, design patterns, interfaces, reflection, local and remote interfaces, final constructors, equals() vs ==, finalize(), static variables, caching across a cluster, and bug prevention techniques.
This lecture describes how we set up the environment for executing Java Application and also describes the tools that are required. This lecture also contains a simple java program and the description.
Interface in java ,multiple inheritance in java, interface implementationHoneyChintal
multiple inheritance in java, interface implementation, abstraction,
multiple inheritance in java using interface, how to use interface,
how to use java, how to execute a java code
An interface is a reference type in Java. It is similar to the class. It is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Along with abstract methods, an interface may also contain constants, default methods, static methods, and nested types.
This lecture describes how we set up the environment for executing Java Application and also describes the tools that are required. This lecture also contains a simple java program and the description.
Interface in java ,multiple inheritance in java, interface implementationHoneyChintal
multiple inheritance in java, interface implementation, abstraction,
multiple inheritance in java using interface, how to use interface,
how to use java, how to execute a java code
An interface is a reference type in Java. It is similar to the class. It is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Along with abstract methods, an interface may also contain constants, default methods, static methods, and nested types.
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...Raffi Khatchadourian
Java 8 default methods, which allow interfaces to contain (instance) method implementations, are useful for the skeletal implementation software design pattern. However, it is not easy to transform existing software to exploit default methods as it requires analyzing complex type hierarchies, resolving multiple implementation inheritance issues, reconciling differences between class and interface methods, and analyzing tie-breakers (dispatch precedence) with overriding class methods to preserve type-correctness and confirm semantics preservation. In this paper, we present an efficient, fully-automated, type constraint-based refactoring approach that assists developers in taking advantage of enhanced interfaces for their legacy Java software. The approach features an extensive rule set that covers various corner-cases where default methods cannot be used. To demonstrate applicability, we implemented our approach as an Eclipse plug-in and applied it to 19 real-world Java projects, as well as submitted pull requests to popular GitHub repositories. The indication is that it is useful in migrating skeletal implementation methods to interfaces as default methods, sheds light onto the pattern’s usage, and provides insight to language designers on how this new construct applies to existing software.
Lecture 8 abstract class and interfacemanish kumar
Abstract class and Interface both are used to achieve the concept of abstraction and using the interface we can implement the concept of multiple inheritance in java.
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMURaffi Khatchadourian
Java 8 default methods, which allow interfaces to contain (instance) method implementations, are useful for the skeletal implementation software design pattern. However, it is not easy to transform existing software to exploit default methods. In this talk, I discuss an efficient, fully-automated, type constraint-based refactoring approach that assists developers in taking advantage of enhanced interfaces for their legacy Java software.
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Raffi Khatchadourian
Java 8 is one of the largest upgrades to the popular language and framework in over a decade. In this talk, I will first overview several new, key features of Java 8 that can help make programs easier to read, write, and maintain, especially in regards to collections. These features include Lambda Expressions, the Stream API, and enhanced interfaces, many of which help bridge the gap between functional and imperative programming paradigms and allow for succinct concurrency implementations. Next, I will discuss several open issues related to automatically migrating (refactoring) legacy Java software to use such features correctly, efficiently, and as completely as possible. Solving these problems will help developers to maximally understand and adopt these new features thus improving their software.
Automated Refactoring of Legacy Java Software to Default Methods Talk at ICSE...Raffi Khatchadourian
Java 8 default methods, which allow interfaces to contain (instance) method implementations, are useful for the skeletal implementation software design pattern. However, it is not easy to transform existing software to exploit default methods as it requires analyzing complex type hierarchies, resolving multiple implementation inheritance issues, reconciling differences between class and interface methods, and analyzing tie-breakers (dispatch precedence) with overriding class methods to preserve type-correctness and confirm semantics preservation. In this paper, we present an efficient, fully-automated, type constraint-based refactoring approach that assists developers in taking advantage of enhanced interfaces for their legacy Java software. The approach features an extensive rule set that covers various corner-cases where default methods cannot be used. To demonstrate applicability, we implemented our approach as an Eclipse plug-in and applied it to 19 real-world Java projects, as well as submitted pull requests to popular GitHub repositories. The indication is that it is useful in migrating skeletal implementation methods to interfaces as default methods, sheds light onto the pattern’s usage, and provides insight to language designers on how this new construct applies to existing software.
Lecture 8 abstract class and interfacemanish kumar
Abstract class and Interface both are used to achieve the concept of abstraction and using the interface we can implement the concept of multiple inheritance in java.
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMURaffi Khatchadourian
Java 8 default methods, which allow interfaces to contain (instance) method implementations, are useful for the skeletal implementation software design pattern. However, it is not easy to transform existing software to exploit default methods. In this talk, I discuss an efficient, fully-automated, type constraint-based refactoring approach that assists developers in taking advantage of enhanced interfaces for their legacy Java software.
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Raffi Khatchadourian
Java 8 is one of the largest upgrades to the popular language and framework in over a decade. In this talk, I will first overview several new, key features of Java 8 that can help make programs easier to read, write, and maintain, especially in regards to collections. These features include Lambda Expressions, the Stream API, and enhanced interfaces, many of which help bridge the gap between functional and imperative programming paradigms and allow for succinct concurrency implementations. Next, I will discuss several open issues related to automatically migrating (refactoring) legacy Java software to use such features correctly, efficiently, and as completely as possible. Solving these problems will help developers to maximally understand and adopt these new features thus improving their software.
Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.
Members of a Java interface are public by default. A member of an abstract class can either be private, protected or public.
An interface is absolutely abstract and cannot be instantiated. An abstract class also cannot be instantiated, but can be invoked if it contains a main method.
oops concept in java | object oriented programming in javaCPD INDIA
object oriented programming is a key concept for the development of application in windows as well as web based application environment. oops concept maps real world through its concept of classes, objects, inheritance, polymorphism which help in making a robust application.
1. Multiple Choice
1) What is an abstract function?
A. A function that can be overridden in an inheriting class
B. A function that has no side-effects
C. A function with no implementation that must be overridden by inheriting classes
2) What is the difference between Stack and Queue?
A. A stack is a Last In First Out (LIFO) data structure, while a Queue is a First In First Out (FIFO)
data structure
B. A stack is made up of a linear array of values, while a Queue is made up of a linked list of ob-
jects
C. They are the same, except that a stack can be larger
3) What does the final declaration mean for a class?
A. It cannot be directly instantiated.
B. It cannot be subclassed.
C. It cannot have a superclass.
4) Which package is implicitly imported for all java classes?
A. java.io
B. java.util
C. java.lang
5) For the definition:
public class someclass
{
int m_var;
}
a) What is the visibility of m_var to another class in the same package?
A. Private
B. Protected
C. Public
b) What is the visibility of m_var to another class in a different package?
A. Private
B. Protected
C. Public
2. c) What is the visibility of m_var to a subclass in a different package?
A. Private
B. Protected
C. Public
6) How many bytes are used by a Java long primitive?
A. It is compiler dependent
B. 4
C. 8
D. 64
7) Which keyword is used on a method to indicate that only a single thread at a time
should execute the method?
A. volatile
B. synchronized
C. transient
D. static
8) Consider the code below. Select the answers that correspond to the output of
running this class.
public class test {
public static void main(String args[]) {
int i=1, j=1;
try {
i++;
j--;
if(i/j > 1)
i++;
}
catch(ArithmeticException e) {
System.out.println(0);
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println(1);
}
catch(Exception e) {
System.out.println(2);
}
finally {
System.out.println(3);
}
System.out.println(4);
}
}
3. A.4
B.3
C.2
D.1
E.0
9) J2EE servlets and jsp files are normally packaged into which type of archive?
A. WAR
B. EAR
C. JAR
D. ZIP
10) Which of the following are features of EJB3.0?
1. Written as POJOs
2. Supports Java Persistence API
3. Requires deployment descriptors
4. Uses annotations
A.1,2 and 3
B.1,2 and 4
C.All of the above
Short Answer
Question #1:
Outline the main differences between J2EE and J2SE. Give an example of a type of ap-
plication where J2EE would be used.
Question #2:
Describe the use of a particular design pattern in a previous project. Do you feel that a
"pattern oriented" design philosophy is useful? Does the use of patterns result in better
software?
4. Question #3:
Explain the purpose of using interfaces in java. Show a simple example that makes use
of an interface.
Question #4:
Briefly describe java reflection and what it is used for. Also, explain the difference be-
tween this and how EJBs are used.
Question #5:
Explain the difference between local and remote interfaces and when each would be
used.
Question #6:
Explain why we cannot declare a constructor as final?
Question #7:
What is the difference between == and equals() ?
Question #8:
Java has a garbage collector so why would you need the finalize() method for? Any Ex-
ample?
Question #9:
What is wrong with the following code. What would be a way to fix it?
class A {
static Vector quad[][];
....
public A(){
int row =50;
int col = 100;
Vector quad[][] = new Vector[row][col];
for ( int i =0; i < row; i++ )
for ( int j =0; j < row; j++ )
quad[i][j] = new Vector(0,1);
}
public int size(){
5. return quad.length;
}
}
Question #10:
A server generates weather forecast maps, a cache is implemented so maps are not re-
generated for the same region, the cache uses the local file system to store the maps ?
What could be the issue if the application is deployed on a cluster of machines? What
solution could you suggest?
Question #11:
Describe your techniques for prevent bugs when writing code?