4
28/10/2024 7:03 pm
Topic starter
Find suitable types for variables. You are given the following types: byte, short, int, long, char, boolean, float, double, and String. Assign the following values to them false, “Palo Alto, CA”, 32767, 2000000000, 0.1234567891011, 0.5f, 919827112351L, 127, ‘c’. Try to assign 32768 to short and see what happens.
1 Answer
3
28/10/2024 7:03 pm
This task is for beginners and has nothing complicated in it! 🙂 Here is my solution:
public class AssignVariables03 { public static void main(String[] args) { byte input1 = 127; short input2 = 32767; int input3 = 2000000000; long input4 = 919827112351L; char input5 = 'c'; boolean input6 = false; float input7 = 0.5f; double input8 = 0.1234567891011; String inout9 = "Palo Alto, C"; } }