Posts

Showing posts with the label oop

Usefull Resource About Java GUI

Image
  https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html#box This video mention about type of layout manager in java. However code in this video use java applet which is not use for java front end anymore. So just watch this video to understand about layout manager. To use the code in the video, you need to add some change to the code.

video about composition and aggregation

Image

final class in java

Final Classes and Methods  Inheritance is surely one of the highly useful features in Java. But at times, it may be desired that a class should not be extendable by other classes to prevent exploitation. For such purpose, we have the final keyword. We have already seen even what final variables are. Final classes and methods are also similar. A class declared as final cannot be extended while a method declared as final cannot be overridden in its subclasses. A method or a class is declared to be final using the final keyword. Though a final class cannot be extended, it can extend other classes. In simpler words, a final class can be a sub class but not a super class. final public class A {     //code } Resource:  http://www.javawithus.com/tutorial/final-classes-and-methods

Abstract Class in java

Image
A class that is declared with abstract keyword, is known as abstract class in java. It can have abstract and non-abstract methods (method with body). Before learning java abstract class, let's understand the abstraction in java first. Abstraction in Java Abstraction  is a process of hiding the implementation details and showing only functionality to the user. Another way, it shows only important things to the user and hides the internal details for example sending sms, you just type the text and send the message. You don't know the internal processing about the message delivery. Abstraction lets you focus on what the object does instead of how it does it. example: In this example, Bike the abstract class that contains only one abstract method run. It implementation is provided by the Honda class. abstract   class  Bike{      abstract   void  run();   }   class  Honda4  extends ...

interface in java

An  interface in java  is a blueprint of a class. It has  -static constants and - abstract methods. The interface in java is  a mechanism to achieve abstraction . There can be only abstract methods in the java interface not method body. It is used to achieve abstraction and multiple inheritance in Java. In other words, you can say that interfaces can have methods and variables but the methods declared in interface contain only method signature, not body. Java Interface also  represents IS-A relationship . It cannot be instantiated just like abstract class. Reference:  https://www.javatpoint.com/interface-in-java

Inheritance and composition in OOP

Image

Note oop c3

Note Oop chapter 3