This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- junit-jupiter-engine alone is good enough to write test cases in Junit 5.. | |
<dependency> | |
<groupId>org.junit.jupiter</groupId> | |
<artifactId>junit-jupiter-engine</artifactId> | |
<version>5.9.1</version> | |
<scope>test</scope> | |
</dependency> | |
-- The above one will add transitive dependencies as below.. | |
Among these dependencies, there is 'junit-jupiter-api' which contains the classes and interfaces that is required to compile your test cases.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1) // Java program to illustrate join() method in Java | |
import java.lang.*; | |
public class JoinDemo implements Runnable { | |
public void run() { | |
System.out.println("INSIDE Thread t run() .. Thread t starting........................................................."); | |
try { | |
System.out.println("Before sleep"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.java; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.stream.Collectors; | |
public class FindEmployeesWithSameSalary { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.java; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class TryFinally { | |
public static void main(String[] args) { | |
List a = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.java; | |
public class Main { | |
public static void main(String[] args) { | |
//case-1: serializing a custom class that does not implement serializable interface | |
////OUTPUT - Got exception while doing serialization... : java.io.NotSerializableException: com.learn.java.Student | |
//case-2: serializing a custom class that implement serializable interface, but no serialversionUID. Deserialize it . ( if JVM same then it will be success.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Singleton { | |
private static Singleton instance = null; | |
public String s; | |
private Singleton() | |
{ | |
s = "hey i am ston"; | |
} | |
public static Singleton getInstance() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java Program to Create An Immutable Class | |
import java.util.HashMap; | |
import java.util.Map; | |
final class Student { | |
private final String name; | |
private final int rollNo; | |
private final Map<String, String> map1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<property name="logAbandoned" value="true"/> | |
<property name="removeAbandoned" value="true"/> | |
<property name="removeAbandonedTimeout" value="30"/> | |
<property name="timeBetweenEvictionRunsMillis" value="30000" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="XXX" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> | |
2 | |
<property name="driverClassName" value="oracle.jdbc.OracleDriver"/> | |
3 | |
<property name="url" value="${oracle.url}"/> | |
4 | |
<property name="username" value="${oracle.user}"/> | |
5 | |
<property name="password" value="${oracle.password}"/> | |
6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdk1.8.0_231 | |
{1=key = 1 | value = mango | leftValue = mango | rightValue = null} | |
****************************************************** | |
{1=key = 1 | value = mango | leftValue = apple | rightValue = null, | |
2=key = 2 | value = apple | leftValue = null | rightValue = mango} | |
****************************************************** | |
{1=key = 1 | value = mango | leftValue = apple | rightValue = null, | |
2=key = 2 | value = apple | leftValue = orange | rightValue = mango, | |
3=key = 3 | value = orange | leftValue = null | rightValue = apple} |
NewerOlder