Skip to content

Instantly share code, notes, and snippets.

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lici.maven</groupId>
<artifactId>maven-module</artifactId>
<version>${project.version}</version>
</parent>
<artifactId>data-service</artifactId>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lici.maven</groupId>
<artifactId>maven-module</artifactId>
<version>${project.version}</version>
</parent>
<artifactId>email-service</artifactId>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lici.maven</groupId>
<artifactId>maven-module</artifactId>
<version>${project.version}</version>
</parent>
<artifactId>frontend</artifactId>
<dependencies>
<dependency>
bin\java --module lici.modules.frontend/lici.modules.frontend.MyConsole
module lici.modules.db {
exports lici.modules.db to lici.modules.services;
provides lici.modules.db.MyDAO with lici.modules.db.MyDAOImpl;
}
String str1 = "Hello";
String str2 = "Hello";
StringBuffer buffer1 = new StringBuffer("hello");
StringBuffer buffer2 = new StringBuffer("hello");
System.out.println(str1.equals(str2));//this return true
System.out.println(buffer1.equals(buffer2));//this return false. Because StringBuffer not override the equals method
public static void main(String[] args) {
String str1 = "Hello";
String str2 = new String("Hello");
String str3 = "World";
String str4 = new String("Hello");
String str5 = "Hello";
if(str1 == str2) {
System.out.println("str1 and str2 shares same memory location");
}
if (str2 == str4) {
public static void main(String[] args) {
String first = new String("Hello")+new String("World");
String second = new StringBuffer().append("Hello ").append("World").toString();
}
public interface Operation {
public int operate(int param1, int param2);
}
public class Calculate {
public void doCalculation(Operation operation) {
System.out.println(operation.operate(10, 20));
}
public static void main(String[] args) {
//From here i want to call doCalculation function. How it possible?
}
}