Quantcast
Viewing latest article 10
Browse Latest Browse All 485

Answer by Federico klez Culloca for What does %s(%s) specifier do?

By itself %s(%s) is simply two string placeholder one after the other, with the second being surrounded by parentheses that have no syntactic meaning as far as format is concerned.

What this piece of code does is simply substituting the content of tabName for the first %s and the result of

String.format("%s,%s,%s,%s,%s,%s,%s","id int primary key auto_increment","surname varchar(50)","name varchar(50)","age int(3)","course int(1)","group varchar(50)","stateFunded int(1)")

for the second one, hence creating something along the lines of

create table if not exists tabName(    id int primary key auto_increment,    surname varchar(50),    name varchar(50),    age int(3),    course int(1),    group varchar(50),    stateFunded int(1))

for whatever value tabName has.


Viewing latest article 10
Browse Latest Browse All 485

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>