1, there is known a, b are integer variable, the value of the swap write a, b, two program variables.
(Knowledge Point: variables and operators comprehensive application)
package second Java job; Import java.util.Scanner; public class second job Java { public static void main (String [] args) { // the TODO Auto-Generated Method Stub char A = 'A' ; char B = 'A' + 32 ; System.out.println (B); } }
2, given a 0 to 1000 integer find each digit and, for example,
as the result 345 is 3 + 4 + 5 = 12 Note: decomposition digital either to
other after molding may be in addition to (knowledge after the first mold: variables and operators
comprehensive application)
package a second time Java operations;
Import java.util.Scanner; public class second job Java { public static void main (String [] args) { // the TODO Auto-Generated Stub Method System.out.println ( "Enter a number of 1 to 1,000" ); Scanner Scan = new new Scanner (the System.in); int A = scan.nextInt (); int B, C, D, E, SUM; E = A / 1000 ; B = A / 100% 10 ; C = A / 10% 10 ; D = 10% A ; SUM = B + C + D +e; System.out.println(sum); } }
3, turn 50 degrees Fahrenheit to Celsius is how much? ? ? (Fahrenheit and Celsius temperature interchangeable, changing from Fahrenheit
degrees you just subtract 32, multiply by 5 and then divided by 9 on the line, the
Celsius converted into Fahrenheit, directly multiplied by 9, divide by 5, plus
i.e., line 32)
package second Java job; Import java.util.Scanner; public class second job Java { public static void main (String [] args) { // the TODO Auto-Generated Method Stub int HSD = 50 ; int SSD; SSD = (HSD-32) *. 5 /. 9 ; System.out.println (SSD); } }
4, given an arbitrary capital letters A ~ Z, convert to lower case. (Knowledge: variables and operators)
Package second Java job; Import java.util.Scanner; public class second job Java { public static void main (String [] args) { // the TODO Auto-Generated Method Stub char A = 'A' ; char B = 'A' + 32 ; System.out.println (B); } }