COMPSCI 2S03 Lecture Notes - Lecture 4: Multiple Choice, Short Circuit
Document Summary
Second part is to write a program in java. Printf is the method (dot operator of class, for methods) import java. util. Package names in java: java. util < package name java. lang < another package. Methods in scanner class nextdouble(), nextline(), nextint(), next(), nextshort() etc. Enter a number: 23(line feed, return key to separate inputs) Enter two number: 23(line feed, return)15(return) < two values assigned to nextint() for example. Enter name: haya(return) < the buffer stores haya. Java will take the enter as the nextline and won"t read the name, so we use nextline to get rid of line return. Another class: buffer, can create an object to read char by char. You can change the code for any number of digits (not just three) by running a loop until you get mod 0. The number of times these statements will be executed is always the same java. lang has some primitive data types.