Sunday 19 November 2017

java - Difference between static modifier and static block

Someone explain to me the differences between the
following two statements?



A static
final
variable initialized by a static code
block:




private static
final String foo;
static { foo = "foo";
}


A static
final
variable initialized by an
assignment:



private static final
String foo = "foo";

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...