Skip to content

Commit

Permalink
Minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
verhovsky authored Sep 29, 2024
1 parent 229dcd2 commit ac96ae7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions java.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,17 @@ public class LearnJava {
var x = 100; // int
var y = 1.90; // double
var z = 'a'; // char
var p = "tanu"; //String
var p = "tanu"; // String
var q = false; // boolean

// Strings
String fooString = "My String Is Here!";

// Java 14 onwards - Text Blocks
// Text blocks
vat textBlock = """
This is a <Text Block> in Java
""";


// \n is an escaped character that starts a new line
String barString = "Printing on a new line?\nNo Problem!";
// \t is an escaped character that adds a tab character
Expand Down Expand Up @@ -870,9 +869,9 @@ public abstract class Mammal()
}
}

//Java Records (introduced in Java 14, finalized in Java 16) are a concise way to define immutable data carrier classes,
//automatically generating boilerplate code like constructors, equals(), hashCode(), and toString().
//This automatically creates an immutable class Person with fields name and age.
// Java Records are a concise way to define immutable data carrier classes, automatically
// generating boilerplate code like constructors, equals(), hashCode()and toString().
// This automatically creates an immutable class Person with fields name and age.
public record Person(String name, int age) {}
Person p = new Person("Alice", 30);

Expand Down

0 comments on commit ac96ae7

Please sign in to comment.