BASE-4502: PR comments and annotation example
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.baeldung.compiletimeconstants;
|
||||
|
||||
public class Annotations {
|
||||
|
||||
private final String deprecatedDate = "20-02-14";
|
||||
private final String deprecatedTime = "22:00";
|
||||
|
||||
@Deprecated(since = deprecatedDate + deprecatedTime)
|
||||
public void deprecatedMethod() {}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class ClassConstants {
|
||||
|
||||
public static final int MAXIMUM_NUMBER_OF_USERS = 10;
|
||||
public static final String DEFAULT_USERNAME = "unknown";
|
||||
|
||||
public static final List<String> DEFAULT_GROUPS = List.of("all", "reader");
|
||||
|
||||
public static final Logger log = LoggerFactory.getLogger(ClassConstants.class);
|
||||
|
||||
@@ -5,16 +5,16 @@ import java.io.PrintWriter;
|
||||
public class CompileTimeVariables {
|
||||
|
||||
public String ERROR_MESSAGE = ClassConstants.DEFAULT_USERNAME + " not allowed here.";
|
||||
public final int MAXIMUM_LOGIN_ATTEMPTS = 5;
|
||||
public final int maximumLoginAttempts = 5 * 5;
|
||||
|
||||
public static void main(String[] args) {
|
||||
PrintWriter printWriter = System.console().writer();
|
||||
printWriter.write(ClassConstants.DEFAULT_USERNAME);
|
||||
printWriter.println(ClassConstants.DEFAULT_USERNAME);
|
||||
|
||||
CompileTimeVariables instance = new CompileTimeVariables();
|
||||
printWriter.println(instance.MAXIMUM_LOGIN_ATTEMPTS);
|
||||
printWriter.println(instance.maximumLoginAttempts);
|
||||
|
||||
final String username = "baeldung";
|
||||
final String username = "baeldung" + "-" + "user";
|
||||
printWriter.println(username);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.baeldung.compiletimeconstants;
|
||||
|
||||
import java.io.Console;
|
||||
public class RunTimeVariables {
|
||||
public class RuntimeVariables {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Console console = System.console();
|
||||
|
||||
final String input = console.readLine();
|
||||
console.writer().write(input);
|
||||
console.writer().println(input);
|
||||
|
||||
final double random = Math.random();
|
||||
console.writer().write("Number: " + random);
|
||||
console.writer().println("Number: " + random);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user