This thesis considers several instances of abstraction that arose in the design and implementation of the web programming language Links. The first concerns user interfaces, specified
using HTML forms. We wish to construct forms from existing form fragments without introducing dependencies on the ...
CS6501 Internet Programming Department of CSE 2015-2016
1 Define Java.
Java is a programming language expressly designed for use in the distributed environment of
the Internet. It was designed to have the "look and feel" of the C++ language, but it is simpler to
use than C++ and enforces an object-oriented programming model.
2. What is a Class?
Class is a template for a set of objects that share a common structure and a common behaviour.
3. What is an Object?
Object is an instance of a class. It has state, behaviour and identity. It is also called as an
instance of a class.
4. What is an Instance?
An instance has state, behaviour and identity. The structure and behaviour of similar classes are
defined in their common class. An instance is also called as an object.
5. What are different types of access modifiers (Access specifiers)?
Access specifiers are keywords that determine the type of access to the member of a class.
These keywords are for allowing privilegesto parts of a program such as functions and
variables. These are: public: Anything declared as public can be accessed from anywhere.
private: Anything declared as private can‘t be seen outside of its class.
protected: Anything declared as protected can be accessed by classes in the same package and
subclasses in the there packages.
default modifier : Can be accessed only to classes in the same package.
6. What is method overloading and method overriding?
Method overloading: When a method in a class having the same method name with different
arguments is said to be method overloading.
Method overriding: When a method in a class having the same method name with same
arguments is said to be method overriding.
7. List the access specifier used in JAVA?
Java provides a number of access modifiers to set access levels for classes, variables, methods
and constructors. The four access levels are:
• Visible to the package. the default. No modifiers are needed.
• Visible to the class only (private).
• Visible to the world (public).
• Visible to the package and all subclasses (protected).
8. What is the difference between Array and vector?
Array is a set of related data type and static whereas vector is a growable array of objects and
dynamic
9. What is a package?
A package is a collection of classes and interfaces that provides a high-level layer of access
protection and name space management.
10. What is meant by Inheritance?
Inheritance is a relationship among classes, wherein one class shares the structure or behaviour
defined in another class. This is called Single Inheritance. If a class shares the structure or
behaviour from multiple classes, then it is called Multiple Inheritance. Inheritance defines ―is-a‖
hierarchy among classes in which one subclass inherits from one or more generalized
superclasses.
11. What is an Abstract Class?
Abstract class is a class that has no instances. An abstract class is written with the expectation
that its concrete subclasses will add to its structure and behaviour, typically by implementing its
abstract operations.
St.joseph‘s college of engineering /St.joseph‘s institute of technology ISO 9001:2008
, www.rejinpaul.com
www.rejinpaul.com
CS6501 Internet Programming Department of CSE 2015-2016
12. What are inner class and anonymous class?
Inner class: classes defined in other classes, including those defined in methods are called inner
classes. An inner class can have any accessibility including private.
Anonymous class: Anonymous class is a class defined inside a method without a name and is
instantiated and declared in the same place and cannot have explicit constructors.
13. Define interface and write the syntax of the Interface.
Interface is an outside view of a class or object which emphaizes its abstraction while hiding its
structure and secrets of its behaviour.
Syntax:
[visibility] interface InterfaceName [extends other interfaces] {
constant declarations
abstract method declarations
}
14. What is the difference between abstract class and interface?
a) All the methods declared inside an interface are abstract whereas abstract class must have at
least one abstract method and others may be concrete or abstract.
b) In abstract class, key word abstract must be used for the methods whereas interface we need
not use that keyword for the methods.
c) Abstract class must have subclasses whereas interface can‘t have subclasses.
15. What is an exception?
An exception is an event, which occurs during the execution of a program, that disrupts the
normal flow of the program's instructions.
16. What is meant by JAVA package?(Nov/Dec 2014)
Package represents a collection of classes, methods and interface. The name of the package
must be written as the first statement in the java source program. Syntax: package
name_of_package
17. What are the types of Exceptions in Java?
There are two types of exceptions in Java, unchecked exceptions and checked exceptions.
Checked exceptions: A checked exception is some subclass of Exception (or Exception itself),
excluding class RuntimeException and its subclasses. Each method must either handle all
checked exceptions by supplying a catch clause or list each unhandled checked exception as a
thrown exception.
Unchecked exceptions:All Exceptions that extend the RuntimeException class are unchecked
exceptions. Class Error and its subclasses also are unchecked.
18. What are the different ways to handle exceptions?
There are two ways to handle exceptions:
• Wrapping the desired code in a try block followed by a catch block to catch the exceptions.
• List the desired exceptions in the throws clause of the method and let the caller of the
method handle those exceptions.
19. How to create custom exceptions?
By Extending the Exception class or one of its subclasses.
class MyException extends Exception {
public MyException() { super(); }
public MyException(String s) { super(s);
St.joseph‘s college of engineering /St.joseph‘s institute of technology ISO 9001:2008
, www.rejinpaul.com
www.rejinpaul.com
CS6501 Internet Programming Department of CSE 2015-2016
} }
20. Write the properties of Threads.(Nov/Dec 2014).
• Thread Priority
• Deamon Thread
• Thread group
21. What is multi-threaded programming?(Nov/Dec 2014)
Multithreading is the ability of a program or an operating system process to manage its use by
more than one user at a time and to even manage multiple requests by the same user without
having to have multiple copies of the programming running in the computer.
22. Write the life cycle of thread.
A thread goes through various stages in its life cycle. For example, a thread is born, started,
runs, and then dies. Following diagram shows complete life cycle of a thread
.
23. What is daemon thread and which method is used to create the daemon thread?
A daemon thread is a thread, that does not prevent the JVM from exiting when the program
finishes but the thread is still running. An example for a daemon thread is the garbage
collection. You can use the setDaemon() method to change the Thread daemon properties
24. What is the purpose of toString() method in java ?
The toString() method returns the string representation of any object. If you print any object,
java compiler internally invokes the toString() method on the object. So overriding the
toString() method, returns the desired output, it can be the state of an object etc. depends on
your implementation.
25. What is immutable string in java?
In java, string objects are immutable. Immutable simply means unmodifiable or
unchangeable.Once string object is created its data or state can't be changed but a new string
object is created.
St.joseph‘s college of engineering /St.joseph‘s institute of technology ISO 9001:2008
, www.rejinpaul.com
www.rejinpaul.com
CS6501 Internet Programming Department of CSE 2015-2016
Eg:
class Testimmutablestring{
public static void main(String args[]){
String s="Sachin";
s.concat(" Tendulkar");//concat() method appends the string at the end
System.out.println(s);//will print Sachin because strings are immutable objects
}
26. Define assert .
Java assertion feature allows developer to put "assert" statements in Java source code to help
unit testing and debugging.
An "assert" statement has the following format:
assert boolean_expression : string_expression;
When this statement is executed:
If boolean_expression evaluates to true, the statement will pass normally.
If boolean_expression evaluates to false, the statement will fail with an "AssertionError"
exception.
27. Define Applet.
An applet is a small Internet-based program written in Java, a programming language for the
Web, which can be downloaded by any computer. The applet is also able to run in HTML. The
applet is usually embedded in an HTML page on a Web site and can be executed from within a
browser.
28. Define transient and volatile Modifiers.
Java defines two interesting type modifiers: transient and volatile. These modifiers are usedto
handle somewhat specialized situations. When an instance variable is declared as transient, then
its value need not persist when an object is stored. For example:
class T {
transient int a; // will not persist
int b; // will persist
}
Here, if an object of type T is written to a persistent storage area, the contents of a would not be
saved, but the contents of b would.
St.joseph‘s college of engineering /St.joseph‘s institute of technology ISO 9001:2008
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller ramkumarramadoss. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R148,82. You're not tied to anything after your purchase.