Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,890 questions

51,817 answers

573 users

How to format the printf function for variables with different datatypes in Scala

1 Answer

0 votes
printf("Int = %d\n", 7643)
printf("Float = %f\n", 3.14)
printf("Char = %c\n", 'a')
printf("String = %s\n", "Scala")
printf("Boolean = %b\n", true)
printf("Hex = %X\n", 456)
printf("Binary = %s\n", 15.toBinaryString)
 
 
 
/*
run:
   
Int = 7643
Float = 3.140000
Char = a
String = Scala
Boolean = true
Hex = 1C8
Binary = 1111
 
*/

 



answered Dec 1, 2024 by avibootz

Related questions

1 answer 183 views
1 answer 186 views
186 views asked Oct 18, 2021 by avibootz
1 answer 175 views
...