Altering format string output by changing a format specifier's argument_index

A format string is a string which can include one or more format specifiers. String hungry = "hungry"; String hippo = "hippo"; String s = String.format( "%s %s", hungry, hippo); Here, “%s %s” is a format string, and %s is a format specifier. The value of s is “hungry hippo”. Modify the order that the arguments appear in the format string by specifying an argument index in the format specifiers....

April 15, 2017 · 1 min · Rezha Julio

Add Autocorrect to Git

If you want git to correct typos you can set help.autocorrect: $ git config --global help.autocorrect 30 You set help.autocorrect to an integer representing the time you have to change your mind before git executes the command (1 = 0.1 seconds). For example: $ git comit WARNING: You called a git command named 'comit', which does not exist. Continuing under the assumption that you meant 'commit' in 3 seconds automatically... ...

April 14, 2017 · 1 min · Rezha Julio

Future of Interface in Java 9

Interface is a very popular way to expose our APIs. Until Java 7 it was getting used as a contract (abstract method) where a child class was obliged to implement the contract; but after Java 8, Interface got more power — to where we can have static and default methods. In Java 9, Interface is getting more power, to the point where we can define private methods as well. Let us understand why we need private methods in Interfaces....

April 13, 2017 · 4 min · Rezha Julio

More about Interface in Java 8

Interface was meant to define a contract before Java 8, where we were able to define the methods a class needed to implement if binding himself with the interface. Interface was only involved with abstract methods and constants. But in Java 8, Interface has become much more, and now it can have methods defined using static or default. Remember that default methods can be overridden, while static methods cannot. Method Definitions Interface was meant for good designers because when we create an Interface, we should know the possible contract that every class should implement....

April 12, 2017 · 4 min · Rezha Julio

Spring Boot in a Single File

Over the years spring has become more and more complex as new functionalities have been added. Just visit the page-https://spring.io/projects and we will see all the spring projects we can use in our application for different functionalities. If one has to start a new spring project we have to add build path or add maven dependencies, configure application server, add spring configuration . So a lot of effort is required to start a new spring project as we have to currently do everything from scratch....

April 11, 2017 · 5 min · Rezha Julio