Skip to main content

Posts

Showing posts with the label Tricks

How to kill a process running on particular port in Linux

  If port 8080 needs to be kill use below single command: kill -9 $(lsof -t -i:8080) Note: remove -9 from the command, if you don't want to kill the process violently. To list any process listening to the port 8080: lsof -i:8080 Use any port number that you want to kill.

How To Print "Hello World" in Java Without Using Semicolon

This can be done in a very simple way. "printf" returns PrintStream. So we can put it in if block and no need to use semicolon. public class HelloClass { public static void main(String a []) { if (System. out .printf( "Hello World" ) == null ) { //No need to define something here } } } //OUTPUT:   // Hello World