MAP

Abstract methods and classes


While going through the java language programming you have learned so many times the word abstract. In java programming language the word abstract is used with methods and classes. 
Abstract Method
An abstract method one that have the empty implementation. All the methods in any interface are abstract by default. Abstract method provides the standardization for the " name and signature" of any method. One can extend and implement to these methods in their own classes according to the requirements.   
  e.g.
public abstract abs_value();
Abstract Class
In java programming language, abstract classes are those that works only as the parent class or the base class. Subclasses are derived to implement the methods inherited from the abstract class (base class). Abstract classes are not instantiated directly. First extend the base class and then instantiate (create objects). Abstract classes are generic in nature and implement to those methods that are used commonly by the subclasses with common implementation. Abstract classes .
e.g.
abstract class A{
   public abstract abs_value();
   
   void show(){
     System.out.println("This is an abstract class");
   }
 }

Java Abstract Class Example

<html>
    <head>
        <title>Using Abstract Classes</title>
    </head>
    <body>
        <h1>Using Abstract Classes</h1>
        <%!
            javax.servlet.jsp.JspWriter pw;
            abstract class Rectangle
            {
               int length, breadth, area;
 abstract int getArea() throws java.io.IOException;
 public void setArea(int length, int breadth) throws java.io.IOException 
                {
                       this.length = length;
                       this.breadth = breadth;
                       pw.println("Calculating the area of a rectangle...........<br>");
                       pw.println("The area of rectangle is  ");
                       pw.println(getArea());
                }
            }
            class Rectangle1 extends Rectangle
            {
                int getArea() throws java.io.IOException 
                {
                    area = length*breadth;
                    return(area);
                }
            }
        %>     
        <%
            pw = out;     
            Rectangle1 rect = new Rectangle1();
            rect.setArea(2,3);
        %>
    </body>
</html>

Interface Vs Abstract Class


There are three main differences between an interface and an abstract class:
  • At the same time multiple interfaces can be implemented, but only extend one class
  • an abstract class may have some method implementation (non-abstract methods, constructors, instance initializers and instance variables) and non-public members
  • abstract classes may or may not be a little bit faster
Main reason for the existence of interfaces in Java is: to support multiple inheritance. Languages supporting multiple implementation inheritance, an interface is equivalent to a fully abstract class (a class with only public abstract members).
The above differentiation suggests when to use an abstract class and when to use an interface:
  • If you want to provide common implementation to subclasses then an abstract class is used,
  • If you want to declare non-public members, the use abstract method
  • In case of abstract class, you are free to add new public methods in the future,
  • If you're confirm regarding the stablity of the API for the long run then use an interface
  • If you want to provide the implementing classes the opportunity to inherit from other sources at the same time then use an interface.
In general, prefer interfaces if you don't need to use an abstract class, because they provide more design flexibility.

Java Abstract Class


An abstract class is a class that is declared by using the abstract keyword. It may or may not have abstract methods. Abstract classes cannot be instantiated, but they can be extended into sub-classes.
Java provides a special type of class called an abstract class. Which helps us to organize our classes based on common methods. An abstract class lets you put the common method names in one abstract class without having to write the actual implementation code.
An abstract class can be extended into sub-classes, these sub-classes usually provide implementations for all of the abstract methods.
The key idea with an abstract class is useful when there is common functionality that's  like to implement in a superclass and some behavior is unique to specific classes. So you implement the superclass as an abstract class and define methods that have common subclasses. Then you implement each subclass by extending the abstract class and add the methods unique to the class.
    
Points of abstract class :

  1. Abstract class contains abstract methods.
  2. Program can't instantiate an abstract class.
  3. Abstract classes contain mixture of non-abstract and abstract methods.
  4. If any class contains abstract methods then it must implements all the abstract methods of the abstract class.

Result - Gujarat Technological University | GTU RESULT | Exam Results 2011, India Results, University Results | GTU Result 2011 - ME, BE, MCA ,MBA,PDDC,ME,GCET,DIPLOMA


05-09-11
Result of MCA SEM 2 - Regular (JUN 2011) Exam
05-09-11 Result of MCA SEM 2 - Remedial (JUN 2011) Exam
02-09-11 Result of PDDC SEM 2 - Regular (JUL 2011) Exam
02-09-11 Result of PDDC SEM 2 - Remedial (JUL 2011) Exam
02-09-11 Result of ME SEM 1 - Remedial (JUN 2011) Exam
30-08-11 Result of MBA SEM 1 - Remedial (JUN 2011) Exam
30-08-11 Result of MCA SEM 1 - Remedial (JUN 2011) Exam
30-08-11 Result of MPH SEM 2 - Regular (JUN 2011) Exam
27-08-11 Result of HM SEM 2 - Regular (JUN 2011) Exam
27-08-11 Result of HM SEM 2 - Remedial (JUN 2011) Exam
27-08-11 Result of HM SEM 3 - Regular (JUN 2011) Exam
25-08-11 Result of M.Pharm SEM 4 - Regular (JUN 2011) Exam
 24-08-11 Result of MBA SEM 3(EVE) - Regular (MAY 2011) Exam
24-08-11 Result of MBA SEM 2 - Regular (MAY 2011) Exam
24-08-11 Result of MBA SEM 2 - Remedial (MAY 2011) Exam
18-08-11 Result of BP SEM 1 - Remedial (JUL 2011) Exam
18-08-11 Result of BP SEM 2 - Regular (JUL 2011) Exam
18-08-11 Result of BP SEM 2 - Remedial (JUL 2011) Exam
16-08-11 Result of BE SEM 4 - Regular (JUN 2011) Exam
16-08-11 Result of BE SEM 4 - Remedial (JUN 2011) Exam
11-08-11 Result of DIPL SEM 2 - Remedial (JUN 2011) Exam - Only for those student who have appeared in Diploma Sem - VI Exam
11-08-11 Result of DPH Year 1 - Regular (JUN 2011) Exam
11-08-11 Result of ME SEM 4 - Regular (MAY 2011) Exam
11-08-11 Result of MBA SEM 3 - Remedial (JUN 2011) Exam
10-08-11 Result of BE SEM 5 - Remedial (JUN 2011) Exam
08-08-11 Know your STPI : Semester Theory Performance Index
08-08-11 Result of PDDC SEM 4 - Regular (JUN 2011) Exam
05-08-11 Result of PDDC SEM 1 - Remedial (JUN 2011) Exam
05-08-11 Result of BPH SEM 4 - Regular (JUN 2011) Exam
05-08-11 Result of BPH SEM 4 - Remedial (JUN 2011) Exam
05-08-11 Result of BPH SEM 5 - Remedial (JUN 2011) Exam
29-07-11 Result of BE SEM - 3 - Remedial (MAY 2011) Exam
28-07-11 Result of DP Year 2 - Regular (JUN 2011) Exam
28-07-11 Re-checking Result of Diploma Pharmacy-Year-1 (Remedial Exam-April 2011)
25-07-11 Result of MBA Sem -4  Regular (May-2011) Exam
21-07-11 Result of B.E Sem -6 Regular (May-2011) Exam
21-07-11 Result of M.E Sem -3 Remedial (June-2011) Exam
21-07-11 GCET - 2011 (Provisional Rank) Mock round - 1 Result
GCET - 2011 (Provisional Rank) Mock round - 1 Result - [Alternate link]
20-07-11 Result of DIPL Sem -5 Remedial (June-2011) Exam [Re-checking / Reassessment]
20-07-11 Result of MCA Sem -3 Remedial (June-2011) Exam
20-07-11 Result of M.Pharm Sem -1 Remedial (June-2011) Exam
16-07-11 Change in Grade Due to Mid Internal mark Update
15-07-11 Diploma engineering sem – VI Rechecking/ Reassessment Result
13-07-11 Result of Diploma Sem -4 Remedial (June-2011) Exam
12-07-11 Change in Grade Due to Mid Internal mark Update
11-07-11 Result of Diploma Sem -5 Remedial (June-2011) Exam
11-07-11 Result of Diploma Sem -3 Remedial (May-2011) Exam
09-07-11 Result of BPH SEM - 3 Remedial (May - 2011) Exam
08-07-11 Change in Grade Due to Mid - Internal Mark Update
07-07-11 Result of BPH SEM - 6 Regular (May - 2011) Exam
07-07-11 Result of MCA SEM - 4 Regular (May - 2011) Exam
30-06-11 Result of Diploma SEM  - 6 - Regular (June-2011) Exam
10-06-11 Result of Diploma SEM  - 6 - Architectural Assistantship - Regular (June-2011) Exam
24-05-11 Result of DPH SEM 1 - Remedial (APR 2011) Exam
23-05-11 Rechecking Result BE SEM - I - GRADE CHANGE
12-05-11 Rechecking Result Diploma SEM - I - GRADE CHANGE
10-05-11 Rechecking Result B.E SEM -V - GRADE CHANGE
10-05-11 Rechecking Result B.E SEM -III - GRADE CHANGE
10-05-11 Rechecking / Re-Assessment Result Diploma SEM -V - GRADE CHANGE
10-05-11 Rechecking Result Diploma SEM -III - GRADE CHANGE
10-05-11 Rechecking Result B.Pharm SEM -I - GRADE CHANGE
09-05-11 Rechecking /Re-assessment Result ME SEM -I - GRADE CHANGE
09-05-11 Rechecking /Re-assessment Result MCA SEM -III - GRADE CHANGE
09-05-11 Rechecking /Re-assessment Result MCA SEM -I - GRADE CHANGE
09-05-11 Rechecking /Re-assessment Result M.Pharm SEM -I - GRADE CHANGE
09-05-11 Rechecking / Re-assessment Result ME SEM-II - NO GRADE CHANGE
SOURCE WWW.GTU.AC.IN

Twitter Delicious Facebook Digg Stumbleupon Favorites More