🔒 Closed Creating an order form in java console

Status
Not open for further replies.
Heto try this sa code mo:

System.out.format("%s %s %s", "My", "name", "is Princess");

....or.... (mas flexible)

String myFormat="%s %s %s";
System.out.format(myFormat, "My", "name", "is Princess");

Try also this:

System.out.format("%4$2s %3$2s %2$2s %1$2s", "Name", "Surname", "Age", "Course");

....or.... (mas flexible)

String myFormat="%4$2s %3$2s %2$2s %1$2s";
System.out.format(myFormat, "Name", "Surname", "Age", "Course");

Sa Java Documentation, try to read the topic about CLASS FORMATTER (it's part of the java.util library)... very very useful.
 
Heto try this sa code mo:

System.out.format("%s %s %s", "My", "name", "is Princess");

....or.... (mas flexible)

String myFormat="%s %s %s";
System.out.format(myFormat, "My", "name", "is Princess");

Try also this:

System.out.format("%4$2s %3$2s %2$2s %1$2s", "Name", "Surname", "Age", "Course");

....or.... (mas flexible)

String myFormat="%4$2s %3$2s %2$2s %1$2s";
System.out.format(myFormat, "Name", "Surname", "Age", "Course");

Sa Java Documentation, try to read the topic about CLASS FORMATTER (it's part of the java.util library)... very very useful.
Masyadong mahirap. Hahaha. Wala ako nagets
 
kung nahihirapan ka sa may format mam, pwede namang

String name = "test";
String lName = "lang";

System.out.print(name +" " +lName);
 
Princess Serrano
Subukan mo yung binigay ni codyscott
Yon ang pinaka magandang formatting.
Bale yung %s %s %s ay tatlong PLACEHOLDERS ng string..... kada isang %s ay lalagyan mo siya ng STRING

Halimbawa:
System.out.format("%s", "First Name"); <------isang placeholder, isang String
System.out.format("%s %s", "First Name", "Last Name"); <-----dalawang placeholders, dalawang Strings

Yun namang "%4$2s %3$2s %2$2s %1$2s"...ay apat na PLACEHOLDERS.... kada isa ay lalagyan mo siya ng STRING... yung $2s ay spaces.... subukan mong palitan yung 2 ng say 5. tapos tignan mo kung anong mangyayari sa distances.

ganon lang yun.
 
Status
Not open for further replies.

About this Thread

  • 9
    Replies
  • 753
    Views
  • 5
    Participants
Last reply from:
madara1992x

Online now

Members online
351
Guests online
1,176
Total visitors
1,527

Forum statistics

Threads
2,275,516
Posts
28,963,796
Members
1,232,827
Latest member
Nash3790
Back
Top