Posts

JDAY 0: word swapping, input / output, calculation of hypotenese, Random numbers

  package day1; //import java.util.Scanner ; public class day1 { public static void main( String [] args ) { String x = "hey" ; String y = "what" ; String z ; z = x ; x = y ; y = z ; System. out .println( "my word is " + x ); System. out .println( "my word is " + y ); } } Enter your name, age and get the your name and age as output package day1; import java.util.Scanner; public class day1 { public static void main(String[] args ) { Scanner sc = new Scanner(System. in ); System. out .println( "your name is? " ); String name = sc .nextLine(); System. out .println( "What is your age?" ); int age = sc .nextInt(); System. out .println( "my name is " + name ); System. out .println( "my age is " + age ); } } using sc .nextLine(); to clear the /n stored in the box package day1; import java.util.Scanner; public class day1 { ...

LEARNING SOME BASICS OF JAVA

// compares two values and return in boolean    package day1; import java.util.Scanner; public class day1 { public static void main(String[] args ) { int x =10; int y =2; boolean c = x == y ; System. out .println( c ); } }
 Test 1