public class App {
public static void main(String[] args) {
// Ineficient
String info = "";
info += "Numele meu este Popescu.";
info += " ";
info += "Eu sunt un constructor.";
System.out.println(info);
// Eficient.
StringBuilder sb = new StringBuilder("");
sb.append("Numele meu este Elena.");
sb.append(" ");
sb.append("Eu sunt profesoara de Java.");
System.out.println(sb.toString());
// La fel ca mai sus dar mai frumos scris
StringBuilder s = new StringBuilder();
s.append("Numele meu este Alex.")
.append(" ")
.append("Eu sunt aviator.");
System.out.println(s.toString());
///// Formatarea //////////////////////////////////
// Iesire linii noi si file
System.out.print("Aici este un text.\tAceasta a fost o fila.\nAceasta a fost o linie noua.");
System.out.println(" Mai mult text.");
// Formatarea numerelor intregi
// %-10d inseamna: scoateti un nr.intreg intr-un spatiu de zece caractere
// padding cu spatiu si aliniere la stanga (%10d s-ar alinia la dreapta)
System.out.printf("Cost total %-10d; cantitatea este %d\n", 5, 120);
// Demonstrarea secvențelor de control pentru formatarea //întregului și a șirurilor
for(int i=0; i<20; i++) {
System.out.printf("%-2d: %s\n", i, "aici este ceva text");
}
// Formatarea valorii în virgulă mobilă
// Doua zecimale
System.out.printf("Valoarea totala: %.2f\n", 5.6874);
// O zecimală, aliniată la stânga într-un câmp de 6 caractere:
System.out.printf("Valoarea totala: %-6.1f\n", 343.23423);
//De asemenea, putem utiliza metoda String.format() daca dorim sa prelucram
// un sir formatat.
String formatted = String.format("Aceasta este o valoare în virgulă mobilă: %.3f", 5.12345);
System.out.println(formatted);
//Utilizați tipul de date double %% pentru a afișa semnul %.
System.out.printf("Sa oferim %d%% este fizic imposibil.", 100);
}
}
Output is:
Numele meu este Popescu. Eu sunt un constructor.
Numele meu este Elena. Eu sunt profesoara de Java.
Numele meu este Alex. Eu sunt aviator.
Aici este un text. Aceasta a fost o fila.
Aceasta a fost o linie noua. Mai mult text.
Cost total 5 ; cantitatea este 120
0 : aici este ceva text
1 : aici este ceva text
2 : aici este ceva text
3 : aici este ceva text
4 : aici este ceva text
5 : aici este ceva text
6 : aici este ceva text
7 : aici este ceva text
8 : aici este ceva text
9 : aici este ceva text
10: aici este ceva text
11: aici este ceva text
12: aici este ceva text
13: aici este ceva text
14: aici este ceva text
15: aici este ceva text
16: aici este ceva text
17: aici este ceva text
18: aici este ceva text
19: aici este ceva text
Valoarea totala: 5,69
Valoarea totala: 343,2
Aceasta este o valoare în virgulă mobilă: 5,123
Sa oferim 100% este fizic imposibil.
открыть франшизу открыть франшизу .
http://mexicanpharmi.com/# п»їbest mexican online pharmacies
франшиза для бизнеса франшиза для бизнеса .
магазин франшиз магазин франшиз .
https://indiapharmi.com/# best online pharmacy india
франшиз франшиз .
nowadays we would always use eco-friendly stuffs like, eco friendly foods, shoes and bags~
best crypto drainer – buy crypto drainer, money drain
I beloved as much as you’ll obtain performed proper here. The comic strip is attractive, your authored subject matter stylish. however, you command get got an nervousness over that you want be handing over the following. in poor health indisputably come further previously again since exactly the same nearly a lot often inside case you defend this hike.
https://mexicanpharmi.com/# pharmacies in mexico that ship to usa
магазин франшиз магазин франшиз .
таможенные брокеры таможенные брокеры .
таможенный брокер россия таможенный брокер россия .
new treatments for ed: Best Canadian online pharmacy – ed drugs online
I am glad for writing to make you understand of the beneficial discovery my wife’s princess encountered checking your web site. She realized some details, including how it is like to possess a marvelous giving spirit to have the mediocre ones clearly gain knowledge of a number of tricky subject matter. You truly exceeded people’s desires. Thanks for coming up with the beneficial, trustworthy, informative and as well as easy tips on the topic to Evelyn.
Hello, i like the way you post on your blog”
pharmacy website india: Indian online pharmacy ship to USA – india online pharmacy
международный таможенный брокер международный таможенный брокер .
таможенные брокеры вэд таможенные брокеры вэд .
таможенный брокер сайт таможенный брокер сайт .
cheapest online pharmacy india: indian pharmacy – india online pharmacy
http://mexicanpharmi.com/# best online pharmacies in mexico
таможенные брокеры москва таможенные брокеры москва .
best online pharmacies in mexico: Online pharmacy – mexico drug stores pharmacies
nfvj;tyysq ,hjrth nfvj;tyysq ,hjrth .
buy ed pills online: canadian pharmi – pills for ed
покупка франшизы покупка франшизы .
https://canadianpharmi.com/# erectile dysfunction natural remedies
Thanks for another informative web site. Where else could I get that kind of information written in such an ideal way? I’ve a project that I’m just now working on, and I have been on the look out for such information.
Comfortabl y, the article is really the top on this deserving topic. I fit in with your conclusions and can thirstily look forward to your coming updates. Simply just saying thanks will not simply be enough, for the awesome clarity in your writing. I will certainly perfect away grab your rss feed to stay informed of any updates. Genuine work and much success in your business efforts!
https://indiapharmi.com/# india pharmacy mail order
выведение из запоя на дому санкт петербург выведение из запоя на дому санкт петербург .
mexico pharmacies prescription drugs: mexican pharmi – purple pharmacy mexico price list
вывод из запоя капельница вывод из запоя капельница .
выведение из запоя на дому спб цены выведение из запоя на дому спб цены .
истинный запой https://vip.rolevaya.info/viewtopic.php?id=6939/ .
вывод из запоя в санкт-петербурге вывод из запоя в санкт-петербурге .
I simply wanted to appreciate you again. I’m not certain the things that I might have sorted out without these tips revealed by you relating to such subject. It absolutely was a distressing situation in my circumstances, however , coming across the well-written tactic you handled that took me to leap for fulfillment. Now i’m thankful for your information as well as trust you recognize what a great job you are undertaking instructing the mediocre ones via your websites. More than likely you haven’t encountered any of us.
You lost me, friend. What i’m saying is, I imagine I am what youre saying. I am aware what you’re saying, however, you just appear to have forgotten that might be another folks inside the world who view this issue for which it truly is and may even perhaps not go along with you. You may well be turning away many people that may have been lovers of your website.
indian pharmacies safe Indian online pharmacy ship to USA mail order pharmacy india
вывод из запоя спб цены вывод из запоя спб цены .
вывод из запоя на дому в спб вывод из запоя на дому в спб .
брокеры таможенное оформление брокеры таможенное оформление .
generic ed drugs Cheapest drug prices Canada cheap medications
https://canadianpharmi.com/# ed treatment natural
best online pharmacy india: Indian online pharmacy ship to USA – india pharmacy
buying prescription drugs in mexico Legit online Mexican pharmacy mexican pharmaceuticals online
Cause of Arthritis… […]just below, are some totally unrelated sites to ours, however, they are definitely worth checking out[…]…
world pharmacy india: India pharmacy delivery – india pharmacy
Good day, I merely hopped over on your own website through StumbleUpon. Not something I’d usually read, however I appreciated how you feel none the less. Thanks for making something price reading.