Advertisement
Vendrick-Xander

HW #4

Nov 27th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. 1. int a
  2. 2. int | char
  3.  
  4. 4. 12.5
  5. 5. 6
  6. 6. error (It can't store non-number values in an int)
  7.  
  8. 23. float a = 34.2;
  9. 24. int a = 10;
  10. 25. boolean a = false;
  11. 26. char a = 'B';
  12.  
  13. 33. int cannot store decimal values.
  14. 34. double is larger than float so a float value cannot store something that is as large as a double value.
  15. 38. Although char can store numbers, it can only store one character, so 67 won't fit in a char
  16. 39. There is no error. 1 evaluates to true in booleans so if a were called it would give the value true
  17.  
  18. 40. int cannot store decimal values, so you need to either change the value in the int or change int to float/double
  19. 41. You forgot to add a semicolon to the end of the line of code, just add the semicolon and the code will work
  20.  
  21. 46. string a = "****";
  22. system.out.println(a);
  23.  
  24. 52. I would tend to let the code take as much space as it needed in order for comments to be written, because if you have comments in your code that will allow you or others to remember what certain lines are doing.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement