String frase = "Que todo fluja y que nada influya";
int largo = 0;
largo = frase.length();
for (int i = 1; i <= largo; i++) {
if (i % largo == 0) {
System.out.print(i.ToUpperCase());
} else {
System.out.print(i.ToLowerCase());
}
String frase = "Que todo fluja y que nada influya";
int largo = 0;
largo = frase.length();
for (int i = 1; i <= largo; i++) {
if (i % largo == 0) {
System.out.print(i.ToUpperCase());
} else {
System.out.print(i.ToLowerCase());
}
A solution would solve several problems that your code has.
i
is the index, it should serve to get each character of the word like this:
frase.charAt(i)
odd and even positions must be obtained, divide the index / 2 and check if it equals 0
import java.util.*;
import java.lang.*;
class MinMayus {
public static void main(String args[]) {
String frase = "Que todo fluya y que nada influya";
int largo = 0;
largo = frase.length();
for (int i = 0; i < largo; i++) {
if (i % 2 == 0) {
System.out.print((frase.charAt(i) + "").toUpperCase());
} else {
System.out.print((frase.charAt(i) + "").toLowerCase());
}
}
}
}