**we can simplify junit and selenium comparision as follow** :--

 - Junit is used majorly to test server side/backend/Custom API unit
   testing, for ex: you make use of junit apis along with java code to
   test your backend logic by writing small parameteriasied method to
   check your code logic. Junit is also used with Selenium to automate
   everything.

		+++++++++++++++ **Sample Junit test Case** +++++++++++++++++++
		import org.junit.Test;
		import static org.junit.Assert.*;
		public class jUnitTestCase{
			@Test
			public void testConcatenation() {
				MyUnit myUnit = new performConcatenation();
				String result = myUnit.concatenate("A", "B");
				assertEquals("AB", result);
			}
		}
		+++++++++++++++ **Sample Custom API to be unit tested** +++++++++++++++
		public class performConcatenation{
			public String concatenate(String A, String B){
				return A+B;
			}
		}

 - Where as Selenium is a tool (.jar+exe) which you use and then write
   use case in terms of programming to invoke browser to automate UI
   testing.

  
  +++++++++++++++ **Sample Selenium test Case** +++++++++++++++++++

   public class LinkedInLogin {

	public static void main(String[] args) {
			  WebDriver driver=new ChromeDriver(); driver.manage().window().maximize(); 
			  driver.get("https://www.linkedin.com/login"); 
			  System.out.println("linked in invoked..............");
			  WebElement username=driver.findElement(By.id("username")); 
			  WebElement password=driver.findElement(By.id("password")); 
			  WebElement login=driver.findElement(By.xpath("//button[text()='Sign in']")); 
			  username.sendKeys("[email protected]"); password.sendKeys("your inkedIn Password"); 
			  login.click(); String actualUrl="https://www.linkedin.com/feed/"; 
	}
}