DNE Does not exists!
Sunday, February 22, 2026
Tuesday, February 3, 2026
Java program to convert Decimal to Binary
import java.util.Scanner;
class D2B
{
public static void main(String[] args)
{
System.out.print("Enter a decimal number :");
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
String binary = "";
while(num > 0)
{
binary = num%2 + binary;
num = num/2;
}
System.out.print(binary);
}
}
Output:
java string value + int is a string or not?
When a Java
String value is concatenated with an int value using the + operator, the result is a String. This behavior is due to Java's rules for the
+ operator: - If either operand is a
String, the other operand is automatically converted to its string representation (e.g., the integer10becomes"10"). - The operator then performs string concatenation.
Example:
String value = "The answer is: ";
int number = 42;
String result = value + number;
// The value of 'result' will be the string "The answer is: 42"
Subscribe to:
Posts (Atom)
Henry's law constant for CO 2 in water is 1.67×10 ∘ Pa at 298 K . Calculate the quantity of CO 2 in 500 mL , of soda water when packed under 2.5 atm CO 2 pressure at 298 K .
Explanation To calculate the amount of CO 2 dissolved, we use Henry's Law: P = k H × x _ C O 2 where:\ P = partial pressure of...
-
//The HTML index page <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change ...
-
Here are some links to online work sites https://www.upwork.com/ https://www.guru.com/ https://studio.envato.com/freelance-switch/ htt...
-
https://www.educba.com/python-list/?btnz=wsm-fb-ros&utm_source=quora&utm_medium=referral
.png)
.png)
.png)