Converting float to string - Java Program
In the post converting String to float we have already seen ways to do that conversion. This post is about doing just the reverse; convert float values to string. Concatenating with an empty...
View ArticleConverting string to double - Java Program
There are several instances when you want to convert a string to double data type so in this post we’ll see what different ways do we have for this conversion. In Java, Doubleclass provides two methods...
View ArticleConverting double to string - Java Program
In the post converting String to double we have already seen ways to do that conversion. This post is about doing just the reverse; convert double values to string. Concatenating with an empty...
View ArticleConverting float to int - Java program
If you have a float number and you have a requirement to show number at some places without decimal points then one of the option is to convert that float type to int and display the value, that’s what...
View ArticleConverting double to int - Java Program
If you have a double number and you have a requirement to show number with out fractional part then one of the option is to convert that double type to int and display the value, that’s what this post...
View ArticleHow to run threads in sequence - Java Program
How to make sure that threads run in sequence is a very popular multi-threading interview question. Though it doesn’t make much sense practically to do that as you use threads so that processing can be...
View ArticleFinding duplicate elements in an array - Java Program
If you have to find duplicate elements in an array first thing you will think is to loop through the array taking one element at a time and then compare it with all the other elements of the array in...
View ArticleInjecting inner bean in Spring
Let’s say you have a Java class which refers to another class object and the access type for that object is private. In that case what do you think is the best way to provide bean definition in Spring....
View ArticleHow to create deadlock in Java multi-threading - Java Program
This post is about creating a deadlock in a multi-threaded Java Program.Deadlock can happen if there are nested synchronized blocks in your code. There are 2 things to note here - Locks are acquired at...
View ArticleHow to compile Java program at runtime
This post talks about how you can compile a java program at runtime. You may have a case where you get a Java file from some property file and you need to run it or Program file is created rather than...
View ArticleHow to run javap programmatically from Java Program
If you have a .class file or a jar with .class files and you want to see the structure of a .class file javap is a good option to do that.The javap command disassembles one or more class files. It...
View ArticleRunning Dos/Windows commands from Java program
If you want to run DOS/Windows commands from a Java program it can be done using RunTime class or ProcessBuilder (Note ProcessBuilder is added in Java 5).Using Runtime.getRunTime().execimport...
View ArticleHow to run a shell script from Java program
This post talks about how you can execute a shell script from a Java program. If you have a shell script say test.sh then you can run it from a Java program using RunTime class or ProcessBuilder (Note...
View ArticleData access in Spring framework
If I have to provide 2 keywords to describe how data access is handled by Spring Framework then those 2 words will be - AbstractionAgnosticNow JDBC or any ORM framework do provide abstraction of its...
View ArticleConfiguring DataSource in Spring Framework
In the post Data access in Spring framework it is already discussed in detail that Spring framework uses templates with fixed and call back parts in order to reduce the boiler plate code. In order to...
View ArticleInsert\Update using JDBCTemplate in Spring framework
In the post Data access in Spring framework we have already seen how Spring provides templates for various persistence methods and how templates divide the data access code into fixed part and variable...
View ArticleSelect query using JDBCTemplate in Spring framework
In the post Insert\Update using JDBCTemplate in Spring framework I have already discussed how JDBCTemplate can be used for inserting and updating data in the DB. I left behind the part to read from...
View ArticleHow to read properties file in Spring Framework
There are scenarios when you have to provide few configuration properties in order to configure the resource like in case of Database you need to provide driver class, DB location, user name and...
View ArticleStream API in Java 8
If we have to point out the most important inclusion in Java 8 apart from lambda expression that has to be Stream API.Stream API works in conjunction with lambda expression and provide an easy yet...
View ArticleHow to reverse number - Java Program
How to reverse a number in Java without using any API is asked in many interviews in order to check the logic. Though how to reverse a string is applicable for numbers also by treating them as String...
View Article