Monday, January 21, 2019

Write a Java Program to remove duplicate values from an array?

package seleniumrepo;

public class DisticntElements {
    public static void printDistinctElements(int[] arr){
        for(int i=0;i<arr.length;i++){
            boolean isDistinct = false;
            for(int j=0;j<i;j++){
                if(arr[i] == arr[j]){
                    isDistinct = true;
                    break;
                }
            }
            if(!isDistinct){
                System.out.print(arr[i]+" ");
            }
        }
    }
   
    public static void main(String a[]){
        int[] nums = {5,2,7,2,4,7,8,2,3};
        DisticntElements.printDistinctElements(nums);
    }
}

Related Posts:

  • Difference between Selenium 1, Selenium 2 and Selenium 3 Selenium 1 = Selenium Remote Control Selenium 2 = Selenium Webdriver, which combines elements of Selenium 1 and Webdriver. Selenium 3 = Selenium  1 + Selenium 2 (RC is deprecated and moved to legacy package) … Read More
  • Introduction to Software Testing What is Software Testing: Software Testing is a process of verifying or validating an application with the intention of finding bugs or defects. This can be done through either manually or using automation tool.… Read More
  • Introduction to Test Automation What is Test Automation: Test Automation or Automation Testing is a method of automating execution of tests and then  compares actual test results with predicted or expected results using special softwar… Read More
  • What is Manual Testing and its Advantages, Limitations Manual testing is a testing process that is carried out manually(executing test cases) in order to find defects without the usage of tools or automation scripting. It is the most primitive of all testing types and… Read More
  • Selenium Introduction What is Selenium: Selenium is an Automation Testing Framework which automates web applications for testing purposes. It is an open source and mainly used for automating functional tests and regression tests. Note: It can b… Read More

0 comments:

Post a Comment

Selenium Training in Realtime

Blog helps to a student or IT employee to develop or improve skills in Software Testing.

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts