Cheatography
https://cheatography.com
Adv Integrated Software Dev - Quiz1
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Chap 01: Creating Java programs
System.out.print("Hello World"); |
System.out.println("CSIS 2175"); |
System.out.println(String.format("dd is %.2f, %d", dd , 567)); |
System.out.printf("d is %.2f", dd); |
GUI -> module-info.java : requires java.desktop; |
Chap 02: GUI actions
int selection = JOptionPane.showConfirmDialog(null,
"Would you like to continue?",
"user choice",
JOptionPane.YES_NO_OPTION,
JOptionPane.PLAIN_MESSAGE
);
JOptionPane.showMessageDialog(null,
"User selected " + selection
);
|
Chap 02: GUI actions
String n= JOptionPane.showInputDialog(
null,
"Enter your name"
);
String strHours = JOptionPane.showInputDialog(
null,
"Enter hours worked","Hours entered",
JOptionPane.QUESTION_MESSAGE
);
int hours = Integer.parseInt(strHours);
|
Chap 02: User Input
Scanner input = new Scanner(System.in);
System.out.println("Enter your age");
int age = input.nextInt();
System.out.println("Enter score");
int score = input.nextInt();
//to get rid of enter key
input.nextLine();
System.out.println("Enter your name");
String name = input.nextLine();
System.out.println(
"Hello " + name + " age is " +
age + " score " + score
);
|
|
|
|