Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Variables extends ConsoleProgram
- {
- //GLOBAL VARIABLES --> OUTSIDE ALL FUNCTIONS
- String myName = "Karel the\n Dog"; //DECLARE AND ASSIGN myName
- public void run() //public static void main(String[] args){
- {
- //LOCAL VARIABLES
- int luckyNumber = 11; //whole number
- double currentTemperature = 75.3; //Decimal
- boolean isStudent = true; //1 or 0 (True or False)
- System.out.println(luckyNumber);
- System.out.println(currentTemperature);
- System.out.println(isStudent);
- sayMyName(); //CALL THE FUNCTION sayMyName
- }
- public void sayMyName()
- {
- System.out.println(myName);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment