java - how to format output of resultSet correctly -


I have the code of the following code which should be formatted correctly in Java resultSet . It does not do that though it seems to me. I wonder why I am getting this weird formatted output.

ID Name Age Address Pay 1 Paul 32 California 23000.0 2 Steve 24 New Jersey 22000.0 4 Andrew 24 Washington 25000.0 3 George 29 Colorado 21000.0 5 Andy 26 Texas 2 28000.0 Public Worth Performance Demise Set (result result 2) throws SQLException {resulted in metadata result results Metatata 2 = P Inamsat 2 .getMetaData (); Int count2 = resultSetMetaData2.getColumnCount (); Objects [] objects = new object [count2]; For (int a = 1; a

The inserted questions look like this:

  COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY) INSERT values ​​(1, 'Paul ', 32,' California ', 23000.00); INSERT (2, 'stevie', 24, 'new jersey', 22,000.00) values ​​in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY); INANSETT (3, 'George', 29, 'Colorado', 21000.00) values ​​in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY); INANSETT (4, 'Andrew', 26, 'Washington', 25000.00) in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY); INANSETT (5, 'ANDY', 26, 'Texas 2', 28000.00) in COMPANY2 (ID, NAME, AGE, ADDRESS, SALARY);  

Any help would be greatly appreciated.

format in Java, the minimum number of characters that are written in the width output Specifies. If you want to shorten a longer text field (such as an address), you should try to use it as well, in addition to the non-text areas on the toString () method of the object Depending on formatting, you probably want to trim them first:

  System.out Printf ("% 12.12s", o2.toString (.) Trim ());  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -