Submit Your Site To The Web's Top 50 Search Engines for Free! Java Tutorial: Learn Java Basics For Free | Learn Java

Tuesday, December 17, 2019

What is a method signature in Java? -Learn Java

What is a method signature in Java? -Learn Java


In java, method signature consists of name of the method followed by argument types.

Example:


https://cjavapoint.blogspot.com/
in java return type is not part of the method signature .Compiler will use method signature 
while resolving method calls.

   class Demo
  {
      public void m1(double d){ }
      public void m2(int i)    { }
      public static void main(String args[]){
         Demo d=new Demo();
         d.m1(11.2);
         d.m2(10);
         d.m3();  //CE
    }
  }

CE:cannot find symbol
symbol:method m3(double)
location:class Demo


Within  the same class we cant't take 2 method with the same signature otherwise we will 
get compile time error.

Example:

   public void methodOne() { }
   public int methodOne() { 
    
     return 10;
   }

Output:

Compile time error
methodOne() is already defined in Demo.










             

Monday, December 16, 2019

Aggregation in Java: Definition and Examples -Learn Java

Aggregation in Java: Definition and Examples -Learn Java

Without existing container object if there is a chance of existing contained objects
such type of relationship is called aggregation .
in aggregation objects have weak association.

Example:

Within a department there may be a chance of several professors will work whenever 
we are closing department still there may be a chance of existing department object the
 relationship between department and professor is called aggregation where the objects
 having weak association.

Example:

https://cjavapoint.blogspot.com/

Saturday, December 14, 2019

Composition in Java Example - Learn Java

Composition in Java Example - Learn Java

without existing container object if there is no chance of existing contained object
then the relation between container object and contained object is called composition 
which is a strong association.

Example:

Any university consists of several departments whenever university object destroys automatically 
all the department object will be destroys that is without existing dependent object hence there are associated and this relationship is called composition .



Learn Java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial          
all the programs start with hello java,hello world.Enterprise applications         
programming language

HAS-A relationship in Java - Learn java

HAS-A relationship in Java - Learn java

1.HAS-A Relationship is also knows as composition(or) aggregation.
2.There is no specific keyword to implement HAS-A relationship but mostly 
    we can use new operator.
3.The main advantage of  reusability.

Example:-

class Engine
{
 // engine functionality
}
class Car
{
   Engine e=new Engine();
  //------------------------------;
  //------------------------------;
  //------------------------------;
}

NOTE:-

class car has-a engine reference.
The main dis-advantage of has-a relationship increases dependency between the
components and creates maintains problems.


Learn Java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial          
all the programs start with hello java,hello world.Enterprise applications         
programming language

Thursday, October 3, 2019

What is “tightly encapsulation” in Java? - Learn Java

What is “tightly encapsulation” in Java? - Learn Java

Encapsulation In Java With Realtime Example

A class is said to be tightly encapsulated
If and only if each and every variable of class declared as private.

And there is  no need to be worry about whether class contains corresponding 
getter and setter methods or not or whether these methods are declare as public 
or not.

Encapsulation In Java With Realtime Example:

Example:1
public class Account
  {
           private double balance;
           public double getBalance()
          {
                return balance;
          }
  }

Which of the following classes are tightly encapsulated

 public class A
 {
    private int x=11;(Valid)
 }
class B extends A
 {
    int y=20;(Invalid)
 }
 class C extends A
{
private int z=40;(Valid)
 }

Note : If the parent class is not tightly  encapsulated then  
child class will  not be tightly encapsulated.

learn java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial          
all the programs start with hello java,hello world.Enterprise applications         
programming language

Saturday, September 28, 2019

Encapsulation in Java - Learn Java

Encapsulation in Java - Learn Java

Encapsulation Real Time Example

Binding a data and corresponding method in a single unit is called encapsulation.
If any class follows data hiding and abstraction such type of class is called encapsulated class.


ENCAPSULATION= ABSTRACTION+DATA HIDING

The Main Advantage of Encapsulation.

  1. we can achieve security.
      2. it is improves maintainability and modularity of application.

The Main Disadvantage of Encapsulation.

    1.it is increases length of the code and slow down execution.

Every Data member should be declared as private and for every member we have to maintain 
 getter and setter method.


learn java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial          
all the programs start with hello java,hello world.Enterprise applications         
programming language

Abstraction in Java - Learn Java


Abstraction in Java - Learn Java

Abstraction in oops with Example

  1. Hide internal implementation and just show the set of service
          is called abstraction. 

The Main Advantage of Abstraction
  1. We can achieve security as we are not highlighting our internal implementation.
  2. it improves maintainability of the application.
  3. it improves modularity of the application.
  4.  it improves easyness to use our system.
Use of interface we can implement abstraction.


learn java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial          
all the programs start with hello java,hello world.Enterprise applications         
programming language

Friday, September 27, 2019

What is data hiding in a program? - Learn Java


What is data hiding in a program? - Learn Java

  • Over internal data should not go out directly that is outside person can't access our internal data directly.
  • By using private modifier we can implement data hiding .  

Data Hiding In Java Example Program.

EXAMPLE 
       
        class Account
       {
           private double balance;
           ---------------------------;
          ----------------------------;
        }
    After providing proper username and password only, we can access our Account 
    information.
   Main advantage of data hiding is security.


learn java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial          
all the programs start with hello java,hello world.Enterprise applications         
programming language

Thursday, September 19, 2019

Java - Modifier Types - Learn Java

Access Modifiers In Java With Example Program .  

        The Modifier is applicable for classes and variables.
       they are most importent in java.
       show in the bellow image.

 learn java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial           
all the programs start with hello java,hello world.Enterprise applications          
programming language   
 

Wednesday, September 18, 2019

Object Oriented Programming(OOPs)Concept in Java-Learn Java

Object Oriented Programming(OOPs)Concept in Java-Learn Java

learn java online free and learn java programming this is the
best way to learn java. this is best java tutorial.in this tutorial          
all the programs start with hello java,hello world.Enterprise applications         
programming language    

  1. Abstraction.
  2. Data Hiding.
  3. Encapsulation.
  4. Tightly encapsulation class.
  5. IS-A Relationship(Inheritance).
  6. HAS-A Relationship.
  7. Method Singnature
  8. Polymorphism
  9. Static Control Flow.
  10. Singleton Class.
  11. Fectory Method.       

What is Java? A Beginner's Guide to Learn Java....

What Is Java ?

What is Java? A Beginner's Guide to Learn Java.

java programming for beginners.

Java is a general-purpose programming language that is class-based,object-oriented (although not a pure object-oriented language, as it contains primitive types and designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA),meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. 



 

Java Inheritance Update 2023 With Program And Example

  Java Inheritance Update 2023 With Program And Example  nheritance is one of the essential concepts in object-orientated programming  (OOP)...