Java has always amazed me as a minimalist language - I would suggest that since shorthand lines are not necessary (for example, properties, for example), they were not included.
For example, in C # there are many quick ways to do something like properties:
public int Foo { get; set; }
and shorthand lines:
String bar = @"some string";
Java tends to avoid as much sugar syntax as possible. If you want getters and setters for a field, you should do this:
private int foo; public int getFoo() { return this.foo; } public int setFoo(int foo) { this.foo = foo; }
and the lines should be escaped:
String bar = "some\nstring";
I think this is because C # and Java have different design goals. C # is evolving rapidly, and many functions are constantly being added, but most of them are usually syntactic sugar. Java, on the other hand, is simplicity and ease of understanding. Many of the reasons Java was created were primarily reactions to the complexity of C ++ syntax.
Andrew Hare
source share