GitHub

https://github.com/garymcneelyit/

 

Java Version 11 Course

 

 

 

/* This is a simple Java program.
FileName : “HelloWorld.java”. */
class HelloWorld
{
// Your program begins with a call to main().
// Prints “Hello, World” to the terminal window.
public static void main(String args[])
{
System.out.println(“Hello, World”);
}
}

 


 

 

 

class FirstVariable
{

public static void main ( String[] args ) {
String message = “Initial value” ;
System.out.println( message ) ;
message = “Modified value” ;
System.out.println( message ) ;

}
}

 


 

 

class DataTypes
{
public static void main ( String[] args )
{ char letter = ‘M’ ;
String title = “data types video 4 u” ;
int number = 365 ;
float decimal = 32.0f;
boolean result = true;

System.out.println( “Initial is ” + letter );
System.out.println( “Book is ” + title );
System.out.println( “days are ” + number );
System.out.println( “temperature is ” + decimal );
System.out.println( “answer is ” + result );

}

}

 


 

 

 

class Constants

{ public static void main ( String[] args )

{
// constant hockey.
final int HATTRICK = 3 ;
final int GOAL = 1 ;
final int ASSIST = 1 ;
//any word can go here
int ht , gl , as , total ;
ht = 2 * HATTRICK ;
gl = 2 * GOAL ;
as = 3 * ASSIST ;
total = ( ht + gl + as ) ;

System.out.println( ” Points ” + total ) ;

}

}

 

 

 

 


 

 

 

 

 

 

class Math

{ public static void main ( String[] args )

{ // defining number for program
int num = 50 ;
int factor = 2 ;
int sum = 0 ;
// calculations
sum = num + factor ;
System.out.println ( “add these together ” + sum );
sum = num – factor ;
System.out.println ( “minus these values ” + sum );
sum = num * factor ;
System.out.println ( “times these together” + sum );
sum = num / factor ;
System.out.println ( “divide these values” + sum );

}

}