java - String formatter not formatting the whole string -


i'm trying use string formatter not working expected..

when print sql_query, prints table1, want overall result "select * table1"

package mysql.first;  public class twoconstructor {     public static void main(string[] args) throws exception {             final string sql_query = "select * %s ".format("table1");     } }  

you not calling method in right way :

 final string sql_query = string.format ("select * %s ","table1"); 

you should have read warnings in ide.

read documentation.

note second argument vararg object... args , hence compiled fine.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -