OPEN BOOK. g is a Graphics object.
for (int i=10; i<=30; i += 10) { g.drawRect(i, i, i, i); }
int y = 20; int n = 3; while (n > 1) { g.drawString("n = " + n, 20, y); y += 20; if (n%2 == 0) { n = n / 2; }else{ n = 3*n + 1; } }
boolean fill = true; for (int col=1; col<=5; col++) { fill = (col%2 == 1); for (int row=1; row<=4; row++) { if (fill) { g.fillOval(col*10, row*10, 5, 5); }else{ g.drawOval(col*10, row*10, 5, 5); } fill = !fill; } }
s
before each
of the independent questions.
s = "buenas";
What is the value in s after executing the following code?
s = s.substring(0,1).toUpperCase() + s.substring(1, s.length()-1);
s = "" + Character.toUpperCase(s.charAt(3));
s = s.substring(1).substring(1);
s.toUpperCase(); // Warning: this is a trick question.