Sunday, June 14, 2020

MethodOveriding

MethodOveriding

Method Name having  sameName,SameParamter,sameSignature,sameDataType

package programs;
// A Simple Java program to demonstrate
// method overriding in java
  
// Base Class
class Parent {
    void show()
    {
        System.out.println("Parent's show()");
    }
}
  
// Inherited class
class Child extends Parent {
    // This method overrides show() of Parent
    @Override
    void show()
    {
        System.out.println("Child's show()");
    }
}
  
// Driver class
class Main {
    public static void main(String[] args)
    {
        // If a Parent type reference refers
        // to a Parent object, then Parent's
        // show is called
        Parent obj1 = new Parent();
        obj1.show();
  
        // If a Parent type reference refers
        // to a Child object Child's show()
        // is called. This is called RUN TIME
        // POLYMORPHISM - Interview question
        Parent obj2 = new Child();
        obj2.show();
    }
}


Overriding is done so that a child class can give its own implementation to a method which is already provided by the parent class. 

Method OverLoading

Method OverLoading


Duplicate/Same  method names used or called multiple times with different arguments.


---> Sample Program


package programs;

public class MethodOverloading {

// method
public void method1(int a) {
System.out.println(a);
}

// method
public void method1(String a) {
System.out.println(a);
}

public static void main(String[] args) {
// TODO Auto-generated method stub

// creating object for MethodOverloading

MethodOverloading obj = new MethodOverloading();
    obj.method1(10);
    obj.method1("test");
}

}




i.e

i.argument count should be different.
ii.argument data type should be different.

Saturday, May 16, 2020

Installing & Configuring Jenkins with Java and Gradle

Steps:

Jenkins Installations

1. Go to below url
 https://jenkins.io/download/

2. Click on Download

3. Install the downloaded file.

4. The path where i installed is

C:\jenkins



5.Type cmd on the file path->click enter

6.Paste below in Command Prompt

java -jar jenkins.war --httpPort=9191

7.Provide user name and password.

---------------------------------------------

Steps for setting up JDK and Gradle project in jenkins.

1. Click on manage Jenkins




2. Go to Global Tool Configuration



3.

 Click on JDK Installations

provide

JDK Name : jdk1.8.0_181(As per your installation)

JAVA_HOME : C:\Program Files\Java\jdk1.8.0_181



Click on Gradle Installations


Gradle Name: gradle-5.6.2-all

GRADLE_HOME : C:/MASTER/gradle-5.6.2-all








4. Click Apply and Save.


------------------


1.Click on New item


2. Click on Freestyle Project

3. Click on Advanced under General tab



4. provide the

Project Directory path: D:\Repository\Cable_Branch_2020.4

5. Click on Add build step

6. select

invoke Gradle script



7.

provide below

Command : gradlew test -DEnv=UPCDevFox -DTest_Plan=TargetApi.xml test -i

8. Apply and save.

9. Click on build






Selenium_Grid_With_Docker_Compose(yml file)

 docker-compose.yml version: "3" services:   hub:     image: selenium/hub:3.141.59     ports:       - "4444:4444"   chro...