consider an example :
public class MyClass {
private int myProperty;
public void setMyProperty(int value) {
myProperty = value;
}
public int getMyProperty() {
return myProperty;
}
}
This is the same thing in C#:
public class MyClass {
public int MyProperty {get; set;}
}
Try using Lombok you can write same code like this in java:
@Getter
@Setter
public class MyClass {
private int myProperty;
}
LOL
Java and C# is similar
Python is different
I prefer Javaskript, much simpler objects
var myClass = {myproperty: "name-here" };
Slight variation to one of the above responses:
@Data
public class MyClass {
private int myProperty;
}
to print ' hello world' yo have to go though a long syntax
public static void main(String ... args) {
System.out.println(randomString(-229985452)+' '+randomString(-147909649));
}
public static String randomString(int seed) {
Random rand = new Random(seed);
StringBuilder sb = new StringBuilder();
for(int i=0;;i++) {
int n = rand.nextInt(27);
if (n == 0) break;
sb.append((char) ('`' + n));
}
return sb.t0script();
}
Try this:-
System.out.println("Hello World");
Things now much more simpler than it used to be .
Please log in to reply to this post
You can also log in using your Facebook