class Example
{
{
String[] name
= { "a" ,
"b" ,
"c" ,
"d"}; int n;
n = 4 % name.length;
System.
out.
println(" 4 % 4 is " + n
+ ": " + name
[n
]); n = 7 % name.length;
System.
out.
println(" 7 % 4 is " + n
+ ": " + name
[n
]); n = 50 % name.length;
System.
out.
println("50 % 4 is " + n
+ ": " + name
[n
]); }
}
Y2xhc3MgRXhhbXBsZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmdbXSBuYW1lID0geyAiYSIgLCAiYiIgLCAiYyIgLCAiZCJ9OwoJCWludCBuOwoJCW4gPSA0ICUgbmFtZS5sZW5ndGg7CgkJU3lzdGVtLm91dC5wcmludGxuKCIgNCAlIDQgaXMgIiArIG4gKyAiOiAiICsgbmFtZVtuXSk7CgkJbiA9IDcgJSBuYW1lLmxlbmd0aDsKCQlTeXN0ZW0ub3V0LnByaW50bG4oIiA3ICUgNCBpcyAiICsgbiArICI6ICIgKyBuYW1lW25dKTsKCQluID0gNTAgJSBuYW1lLmxlbmd0aDsKCQlTeXN0ZW0ub3V0LnByaW50bG4oIjUwICUgNCBpcyAiICsgbiArICI6ICIgKyBuYW1lW25dKTsKCX0KfQ==