java code

J

jay'el antonio

please someone help me..what is the code of this output program using java
11
221
3321
44321
554321
6654321
77654321
887654321
 
S

Stefan Ram

jay'el antonio said:
please someone help me..what is the code of this output program using java
11
221
3321
44321
554321
6654321
77654321
887654321

public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.printf
( "11%n221%n3321%n44321%n554321%n6654321%n77654321%n887654321" ); }}
 
S

Stefan Ram

jay'el antonio said:
please someone help me..what is the code of this output program using java
11
221
3321
44321
554321
6654321
77654321
887654321
public final class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.printf
( "11%n221%n3321%n44321%n554321%n6654321%n77654321%n887654321" ); }}

My new version corrects a mistake (a final »%n« was missing),
and takes into account the possible objection that the program
was intended to be written with two nested loops:

public final class Main
{ public static void main( final java.lang.String[] args )
{ while( args == null )while( args == null ); java.lang.System.out.printf
( "11%n221%n3321%n44321%n554321%n6654321%n77654321%n887654321%n" ); }}
 
S

Stuart

My new version corrects a mistake (a final »%n« was missing),
and takes into account the possible objection that the program
was intended to be written with two nested loops:

public final class Main
{ public static void main( final java.lang.String[] args )
{ while( args == null )while( args == null ); java.lang.System.out.printf
( "11%n221%n3321%n44321%n554321%n6654321%n77654321%n887654321%n" ); }}

I was going to ask you whether you have some kind of archive for FAHQ,
but this proves that these gems are hand-crafted on the fly. Nice job, too.

It is a pity that Java offers not so many code obfuscation techniques as
C++ does. I usually enjoy your C++ postings more (especially
(e-mail address removed), that was hilarious).

Regards,
Stuart
 
J

Joshua Cranmer ðŸ§

It is a pity that Java offers not so many code obfuscation techniques as
C++ does. I usually enjoy your C++ postings more (especially
(e-mail address removed), that was hilarious).

I disagree, here is some wonderful code obfuscation. Were I more
involved, I would have tried to find a better obfuscation than roman
numerals for the main string, but, with any luck, the OP is reading this
in a client with variable-width font and the text runs together as a
whole lot of I's.
public class Test {
public static void main(String... args) {
char[] K = new char[256];
int K = 0, Κ = 0;
char[] К = ("ⅠⅠⅠⅠⅠⅠⅠⅠⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅢⅢⅢⅢⅢⅢⅢⅡⅥⅠⅠⅢⅢⅢⅢⅢⅢⅢⅢⅢⅢⅡⅡⅡⅢⅤⅣⅠ" +
"ⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡ" +
"ⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥ" +
"ⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢ" +

"ⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡ").toCharArray();

int Ⲕ = К.length;
while (Κ < К.length) {
switch (К[Κ]) {
case 'Ⅰ': K++; break;
case 'Ⅱ': K--; break;
case 'Ⅲ': K[K]++; break;
case 'Ⅳ': K[K]--; break;
case 'Ⅴ': Ⲕ = Κ; if (K[K] == 0) Κ = K(К, Κ); break;
case 'Ⅵ': Κ = Ⲕ - 1; break;
case 'Ⅶ': System.out.print(K[K]); break;
}
Κ++;
}
}

private static int K(char[] К, int Κ) {
int K = 0;
for (++Κ; Κ < К.length; Κ++) {
if (К[Κ] == 'Ⅴ') K++;
else if (К[Κ] == 'Ⅵ' && K-- == 0) return Κ;
}
return Κ;
}
}
 
S

Stuart

I disagree, here is some wonderful code obfuscation. Were I more
involved, I would have tried to find a better obfuscation than roman
numerals for the main string, but, with any luck, the OP is reading this
in a client with variable-width font and the text runs together as a
whole lot of I's.
public class Test {
public static void main(String... args) {
char[] K = new char[256];
int K = 0, Κ = 0;
char[] К = ("ⅠⅠⅠⅠⅠⅠⅠⅠⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅢⅢⅢⅢⅢⅢⅢⅡⅥⅠⅠⅢⅢⅢⅢⅢⅢⅢⅢⅢⅢⅡⅡⅡⅢⅤⅣⅠ" +
"ⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡ" +
"ⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥ" +
"ⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢ" +

"ⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡ").toCharArray();

int Ⲕ = К.length;
while (Κ < К.length) {
switch (К[Κ]) {
case 'Ⅰ': K++; break;
case 'Ⅱ': K--; break;
case 'Ⅲ': K[K]++; break;
case 'Ⅳ': K[K]--; break;
case 'Ⅴ': Ⲕ = Κ; if (K[K] == 0) Κ = K(К, Κ); break;
case 'Ⅵ': Κ = Ⲕ - 1; break;
case 'Ⅶ': System.out.print(K[K]); break;
}
Κ++;
}
}

private static int K(char[] К, int Κ) {
int K = 0;
for (++Κ; Κ < К.length; Κ++) {
if (К[Κ] == 'Ⅴ') K++;
else if (К[Κ] == 'Ⅵ' && K-- == 0) return Κ;
}
return Κ;
}
}

Wow, that's awful.

At first, this code wouldn't run because for some reasons Thunderbird
treated the K in the lines
char[] K = new char[256];
and the first K in this line
int K = 0, Κ = 0;
both as 0x4B, thus making the code erroneous. Or maybe it was one of the
newsservers that made the substitution.

I never knew that Java allowed Unicode letters in the source code, so I
even learned something new today.

Thanks for sharing,
Stuart

@Stefan Ram: Sorry, Joshua clearly blew you out of the water...
 
J

Joshua Cranmer ðŸ§

At first, this code wouldn't run because for some reasons Thunderbird
treated the K in the lines
char[] K = new char[256];
and the first K in this line
int K = 0, Κ = 0;
both as 0x4B, thus making the code erroneous. Or maybe it was one of the
newsservers that made the substitution.

Looking at your newspost in a mojibaked output:
char[] K = new char[256];
int K = 0, Κ = 0;

So the actual newsgroup text was transported without normalization.
Running some tests, it appears that U+212A KELVIN SYMBOL gets normalized
to the ASCII K under NFC (I thought it was NFKC), which means that
either pasting from the clipboard to your IDE or your actual Java
compiler is doing some NFC normalization. I suppose you could
distinguish the two by seeing if the ASCII K can refer to a variable
called \u212a (Unicode escapes are legal outside of strings in Java).
I never knew that Java allowed Unicode letters in the source code, so I
even learned something new today.

And now you learn a little about Unicode normalization. :)
 
S

Stefan Ram

either pasting from the clipboard to your IDE or your actual Java
compiler is doing some NFC normalization. I suppose you could

To prevent the dreaded clipboard normalization, I will from now on post
my source code in a way that will evade any clipboard normalization.

\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0063\u006c\u0061\u0073\u0073\u0020\u004d\u0061\u0069\u006e
\u007b\u0020\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0076\u006f\u0069\u0064\u0020\u006d\u0061\u0069\u006e\u0028\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u006a\u0061\u0076\u0061\u002e\u006c\u0061\u006e\u0067\u002e\u0053\u0074\u0072\u0069\u006e\u0067\u005b\u005d\u0020\u0061\u0072\u0067\u0073\u0020\u0029
\u0020\u0020\u007b\u0020\u0077\u0068\u0069\u006c\u0065\u0028\u0020\u0061\u0072\u0067\u0073\u0020\u003d\u003d\u0020\u006e\u0075\u006c\u006c\u0020\u0029\u0077\u0068\u0069\u006c\u0065\u0028\u0020\u0061\u0072\u0067\u0073\u0020\u003d\u003d\u0020\u006e\u0075\u006c\u006c\u0020\u0029\u003b\u0020\u006a\u0061\u0076\u0061\u002e\u006c\u0061\u006e\u0067\u002e\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u0066
\u0020\u0020\u0020\u0020\u0028\u0020\u0022\u0031\u0031\u0025\u006e\u0032\u0032\u0031\u0025\u006e\u0033\u0033\u0032\u0031\u0025\u006e\u0034\u0034\u0033\u0032\u0031\u0025\u006e\u0035\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0036\u0036\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0037\u0037\u0036\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0038\u0038\u0037\u0036\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0022\u0020\u0029\u003b\u0020\u007d\u007d
 
S

Stuart

To prevent the dreaded clipboard normalization, I will from now on post
my source code in a way that will evade any clipboard normalization.

\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0063\u006c\u0061\u0073\u0073\u0020\u004d\u0061\u0069\u006e
\u007b\u0020\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0076\u006f\u0069\u0064\u0020\u006d\u0061\u0069\u006e\u0028\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u006a\u0061\u0076\u0061\u002e\u006c\u0061\u006e\u0067\u002e\u0053\u0074\u0072\u0069\u006e\u0067\u005b\u005d\u0020\u0061\u0072\u0067\u0073\u0020\u0029
\u0020\u0020\u007b\u0020\u0077\u0068\u0069\u006c\u0065\u0028\u0020\u0061\u0072\u0067\u0073\u0020\u003d\u003d\u0020\u006e\u0075\u006c\u006c\u0020\u0029\u0077\u0068\u0069\u006c\u0065\u0028\u0020\u0061\u0072\u0067\u0073\u0020\u003d\u003d\u0020\u006e\u0075\u006c\u006c\u0020\u0029\u003b\u0020\u006a\u0061\u0076\u0061\u002e\u006c\u0061\u006e\u0067\u002e\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u0066
\u0020\u0020\u0020\u0020\u0028\u0020\u0022\u0031\u0031\u0025\u006e\u0032\u0032\u0031\u0025\u006e\u0033\u0033\u0032\u0031\u0025\u006e\u0034\u0034\u0033\u0032\u0031\u0025\u006e\u0035\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0036\u0036\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0037\u0037\u0036\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0038\u0038\u0037\u0036\u0035\u0034\u0033\u0032\u0031\u0025\u006e\u0022\u0020\u0029\u003b\u0020\u007d\u007d

Great, now you made me laugh so hard that one of my children woke up.

I'm afraid that Joshua is still in the lead, though.

Regards,
Stuart
 
K

Kevin McMurtrie

Stuart <[email protected]> said:
My new version corrects a mistake (a final »%n« was missing),
and takes into account the possible objection that the program
was intended to be written with two nested loops:

public final class Main
{ public static void main( final java.lang.String[] args )
{ while( args == null )while( args == null ); java.lang.System.out.printf
( "11%n221%n3321%n44321%n554321%n6654321%n77654321%n887654321%n" ); }}

I was going to ask you whether you have some kind of archive for FAHQ,
but this proves that these gems are hand-crafted on the fly. Nice job, too.

It is a pity that Java offers not so many code obfuscation techniques as
C++ does. I usually enjoy your C++ postings more (especially
(e-mail address removed), that was hilarious).

Regards,
Stuart


Obfuscation? (Not sure that the output is very useful. It has been
de-tuned for posting. Sorry.)



import java.io.ByteArrayInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
public class SEA
{
public static void main(
String args[])
throws Exception
{
final String code=""
+"AEQyFMdCUqCRS2Fa4xksfA8USAJqxT"
+"oY4yCCMJznOU5yjEcQzDPWISiJIATk"
+"EY5jHEMJBHMYxDntW9sZehYQypQ5ih"
+"EMYykIQBSntbGYEIIIxDGIYRiGIZCE"
+"AMYqMkVIEIKRCEIMEAhCMYxhmMYTEl"
+"IUBzkCU5SnCIQBHKUtBD02KgCXtHQO"
+"LgxCBCMYyEIQhBjHMB1kEoAzneUIRi"
+"GUYxjGIY+gF0CSkqAheiDDLU6Z0CGH"
+"K8Mujx1JkU7VRrdWDokBZJxEi6wWAF"
+"H0JDgMR/QdVNPTdTMvr/SjKTzbzTrQ"
+"+RWd3fomd973m/SvS+i6/05veeo+pO"
+"7D1X1b1f1j1n1pPTY6pnY9OlFe3fB8"
+"49ypt2P66Gfeu87rtPM/NPNfNvN/OP"
+"OfK/L/Invt3rlXOrKcdd2EJdXpiGCG"
+"ZsBPBAZWPBKTWqHvrutd08rz0NLA5T"
+"THm0InJjrxdV0gRn7bzXzbsOhR02zK"
+"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FnQg6+vqMdUBI1ihhAAowMGsbCCAE"
+"AFoAMgFpWCgjAApCAIAE6DmOpZDMS0"
+"ykHMY7FKOdK12WYAClWFCAjURTDgEA"
+"BEIIxCEFQEAQAYgCCASBAwEaNQsFYR"
+"GSKH0EygANhAgCBC5r6KUjlelHQmb0"
+"JzDAEZkBiRrTCGAAQlQcqFXUUAwAUU"
+"AjaAAHVrAFAwunBxiRuDNB2MuNE1RA"
+"1IxrFNKMjEo0TAY5CsG9akKQzryecO"
+"SQywJaZQztU5qXKUk6BA0YyTNOlwwB"
+"ABAVFQo4xyaHQuiH34A=";
System.out
.println(xS(d64(code)));
}
private final static char[] b64=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
.toCharArray();
private final static byte[] ib64=new byte[256];
private static final char[] stb=
"import jav.ByeAInuS;\nOEFxclLs\tbgd([])hw{f=MT*2,}vkq0@1CPHG"
.toCharArray();
private static final int EOF=-1;
private static final int BREAK=-2;
static
{
for(int i=0;i<ib64.length;++i)
ib64=-1;
for(int i=0;i<b64.length;++i)
ib64[b64]=(byte)i;
}
private static String xS(
byte[] data)
throws IOException
{
final char mtf[][]=nMTF();
final StringBuilder buf=new StringBuilder(
data.length*2);
final Bis dec=new Bis(
new ByteArrayInputStream(
data));
ex(dec,mtf,buf);
return buf.toString();
}
private static byte[] d64(
CharSequence str)
{
return d64(str,0,str
.length());
}
private static byte[] d64(
CharSequence in,
int off,int len)
{
final int outLen=3
*(len/4)
-((in.charAt(off+len
-1)=='=')?((in
.charAt(off+len-2)=='=')?2
:1)
:0);
final byte outBuf[]=new byte[outLen];
int opos=0;
while(opos<outLen)
{
u34(in,off,outBuf,opos);
off+=4;
opos+=3;
}
return outBuf;
}
static void u34(
final CharSequence in,
int inOff,
final byte out[],
int outOff)
{
final byte b1=ib64[in
.charAt(inOff++)];
final byte b2=ib64[in
.charAt(inOff++)];
if((b1==-1)||(b2==-1))
throw new IllegalArgumentException();
out[outOff++]=(byte)((b1<<2)|(b2>>>4));
final char c3=in
.charAt(inOff++);
if(c3=='=')
return;
final byte b3=ib64[c3];
if(b3==-1)
throw new IllegalArgumentException();
out[outOff++]=(byte)((b2<<4)|(b3>>>2));
final char c4=in
.charAt(inOff++);
if(c4=='=')
return;
final byte b4=ib64[c4];
if(b4==-1)
throw new IllegalArgumentException();
out[outOff++]=(byte)((b3<<6)|b4);
}
private static char[][] nMTF()
{
return new char[][]{
stb.clone(),
stb.clone(),
stb.clone(),
stb.clone(),
stb.clone(),
stb.clone(),
stb.clone()};
}
private static char mtfD(
int pos,char table[])
{
final char c=table[pos];
for(int i=pos;i>0;--i)
table=table[i-1];
table[0]=c;
return c;
}
private static void insF(
char c,char table[])
{
for(int i=57;i>0;--i)
table=table[i-1];
table[0]=c;
}
private static int dc(
char table[],Bis in)
throws IOException
{
final int pos=in
.readInt(5);
if(pos<0)
return EOF;
if(pos<=27)
return mtfD(pos,table);
if(pos==29)
{
final int high=in
.readInt(5);
if(high<0)
throw new EOFException();
if(high==30)
return BREAK;
if(high==31)
return EOF;
return mtfD(28+high,
table);
}else if(pos==30)
{
final int ascii=in
.readInt(7);
if(ascii<0)
throw new EOFException();
insF((char)ascii,table);
return ascii;
}
final int utf=in
.readInt(16);
if(utf<0)
throw new EOFException();
insF((char)utf,table);
return utf;
}
private static int ex(
Bis in,char mtf[][],
StringBuilder buf)
throws IOException
{
int hash=0;
int b;
while((b=dc(
mtf[(hash&0x7fffffff)
%mtf.length],in))>=0)
{
buf.append((char)b);
hash=(hash<<8)+b;
}
return b;
}
private static class Bis
{
protected final InputStream in;
protected int bits=0;
protected int acc=0;
Bis(InputStream in)
{
this.in=in;
}
int readInt(int len)
throws IOException
{
if(acc==-1)
return -1;
int b=0;
while(len>0)
{
if(bits<=0)
{
acc=in.read();
if(acc==-1)
return -1;
bits=8;
}
final int shift=bits
-len;
if(shift>0)
{
final int mask=~(~0<<len);
b|=(acc>>>shift)
&mask;
bits-=len;
len=0;
}else if(shift<0)
{
final int mask=~(~0<<bits);
b|=(acc&mask)<<-shift;
len-=bits;
bits=0;
}else
{
final int mask=~(~0<<len);
b|=acc&mask;
bits=0;
len=0;
}
}
return b;
}
}
}
 
L

Lew

lipska said:
Well. Now that everyone has had the obligatory attempt at being a
smartarse and, hopefully, you have had time to figure this out for
yourself, try this. There are some possible 'optimizations' depending on
you view regarding 'unnecessary' variables and hard-coded magic numbers.
I'm sure some of the smartarses will offer their invaluable advice in
this area.
Absolutely.

public class AntiSmartArseClass {

It is pointless to put 'Class' into a class name, as we already now that it's a class from
the (you guessed it) 'class' keyword.

More to the point, thinking in terms of classes is a less powerful mode than
thinking in terms of types. Names should be semantic, and not reflective of
implementation.
public static void main(String[] args) {
int increment = 11;

This would be better as a constant.
int iterations = 8;

int outerindex = 1;
int innerindex= 0;

Looks like you're reinventing the 'for' loop here.
while(outerindex <= iterations){
Yep.

System.out.printf("%d", outerindex * increment);
innerindex = (outerindex * increment) % 10;

And the nested 'for' loop.
while(innerindex > 1){

Which proves that you are all macho and everything, sure, but
the problem is that these variables have too wide a scope. Use
of the 'for' loop brings you proper scoping for free.
System.out.printf("%d", --innerindex);
}
outerindex++;

You really should follow the Java Naming Conventions, which call for camel
case on these variables.
System.out.println();
}
}
}

You're welcome.
 
A

Arne Vajhøj

lipska said:
public static void main(String[] args) {
int increment = 11;

This would be better as a constant.

Well firstly, you buffoon, although const *is* a reserved word in Java
it is not currently used, do you mean final? We have been down this road
soooooo many time before in here haven't we?

He did not say const - he said constant.

Which per JLS and normal Java terminology means static final.

Arne
 
D

Daniel Pitts

please someone help me..what is the code of this output program using
java
11
221
3321
44321
554321
6654321
77654321
887654321

Well. Now that everyone has had the obligatory attempt at being a
smartarse and, hopefully, you have had time to figure this out for
yourself, try this. There are some possible 'optimizations' depending on
you view regarding 'unnecessary' variables and hard-coded magic numbers.
I'm sure some of the smartarses will offer their invaluable advice in
this area.

public class AntiSmartArseClass {

public static void main(String[] args) {
int increment = 11;
int iterations = 8;

int outerindex = 1;
int innerindex= 0;

while(outerindex <= iterations){
System.out.printf("%d", outerindex * increment);
innerindex = (outerindex * increment) % 10;
while(innerindex > 1){
System.out.printf("%d", --innerindex);
}
outerindex++;
System.out.println();
}
}
}

You are a Troll, sans Hunter. You also made that far more complicated
than it needs to be.

public class BetterThanATroll {
public static void main(String[] args) {
String s = "";
for (int i = 1; i <= 8; ++i) {
s = i + s;
System.out.println(i + s);
}
}
}


Now that we've given the OP the answer to his homework, I hope he finds
a job working with you rather than with me.
 
L

Lew

Nope. It does not.

It means a primitive or String literal, an expression involving constants, or a 'final' variable initialized with a constant expression. It need not be 'static'.
The variable concerned has block scope within main.
You cannot apply the static modifier here.

Lipska, you should study Java before blathering. You make no sense.

If you don't even know what a "constant" is in Java, you need to study more..
static final int increment = 11;

my compiler says no with
Illegal modifier for parameter increment only final is permitted

So don't say 'static', duh.

C'mon, learn Java already!
So, you *could say*
final int increment
however this is not a constant because it's (potential) value is not
known at the time of declaration, at this point it is a 'variable'

Right. So?
later you can say (for example)

increment = Integer.parseInt(args[1]);

Now it's a final int but not a constant according to you via apparently
the JLS and 'normal Java terminology'

Disingenuous. Work from the *actual* definition of "constant" in Java, please.
You could increase the visibility of increment to class scope, then you
*can* say
static final int increment = 11;

And that would be a "constant variable" in Java.
but you can also say
static final int increment;
increment is not a constant, it's an uninitialized static final int,
there's a difference.

Yes. That's in the JLS.
You can then say
increment = 11;
However this would make the scope of increment wider which is another
Bloch no no.

This has nothing to do with what I said, which was "use a constant".
Obviously I can't prove the following in Java as the reserved word const
is unused so I'll use C

Irrelevant. Ignored.
So then Arne, how exactly would you make the variable increment constant
within main using your own criteria of a 'constant' in Java being static
final.

Actually, he'd use the Java definition, not the mistaken one.
As always I'll be delighted to be shown how wrong I am.

Yeah, right.

You're wrong because you aren't talking about Java constants.

I said to use a constant. Let's address that advice, hm?
 
S

Simon Lewis

lipska the kat said:
You are a Troll, sans Hunter.

Yes of course. Anyone who doesn't think like you is a troll. Obviously.
You also made that far more complicated
than it needs to be.

public class BetterThanATroll {
public static void main(String[] args) {
String s = "";
for (int i = 1; i <= 8; ++i) {
s = i + s;
System.out.println(i + s);
}
}
}


Now that we've given the OP the answer to his homework, I hope he finds
a job working with you rather than with me.

I'm prepared to give anyone the benefit of the doubt ... once. Unlike you
apparently. Fortunately I no longer have to work with people who are so far up
themselves they can see the sky. I can pick and choose my projects and my
colleagues, I doubt you'd make it past the reception desk.

Well said.
 
S

Simon Lewis

lipska the kat said:
You are a Troll, sans Hunter. You also made that far more complicated
than it needs to be.

public class BetterThanATroll {
public static void main(String[] args) {
String s = "";
for (int i = 1; i <= 8; ++i) {
s = i + s;
System.out.println(i + s);
}
}
}

Well now let's analyze your 'solution' shall we.

Agreed the 'specification' is a little lacking but as we are unable to go back
to the client at this time we need to make some assumptions.

Assumption 1. It's 'homework'

OK, now what do you imagine the learning objectives are?

Well it certainly looks 'loopy' so

Assumption 2. It's intended to get the student to learn about loop control
variables, possibly to control nested loops.

The output is numeric so

Assumption 3. It's intended to exercise some understanding of manipulation of
numeric variables ...

Well that's about it for the assumptions, now how does your solution meet the
objectives?

... ah yes, String concatenation in a for loop

1/10 for effort

Nicely done. Why is that Java groups and IRC channels in particular are
so full of self inflated pompous idiots who seem to be there only to
belittle others and demonstrate their inate stupidity and narrow
mindedness?
 
D

Daniel Pitts

lipska the kat said:
On 2/23/14 1:25 AM, lipska the kat wrote:
On 21/02/14 00:03, jay'el antonio wrote:
please someone help me..what is the code of this output program using
java
11
221
3321
44321
554321
6654321
77654321
887654321

You are a Troll, sans Hunter. You also made that far more complicated
than it needs to be.

public class BetterThanATroll {
public static void main(String[] args) {
String s = "";
for (int i = 1; i <= 8; ++i) {
s = i + s;
System.out.println(i + s);
}
}
}

Well now let's analyze your 'solution' shall we.

Agreed the 'specification' is a little lacking but as we are unable to go back
to the client at this time we need to make some assumptions.

Assumption 1. It's 'homework'

OK, now what do you imagine the learning objectives are?

Well it certainly looks 'loopy' so

Assumption 2. It's intended to get the student to learn about loop control
variables, possibly to control nested loops.

The output is numeric so

Assumption 3. It's intended to exercise some understanding of manipulation of
numeric variables ...

Well that's about it for the assumptions, now how does your solution meet the
objectives?

... ah yes, String concatenation in a for loop

1/10 for effort

Nicely done. Why is that Java groups and IRC channels in particular are
so full of self inflated pompous idiots who seem to be there only to
belittle others and demonstrate their inate stupidity and narrow
mindedness?
What, are you lipska's alter ego?
 
D

Daniel Pitts

You are a Troll, sans Hunter. You also made that far more complicated
than it needs to be.

public class BetterThanATroll {
public static void main(String[] args) {
String s = "";
for (int i = 1; i <= 8; ++i) {
s = i + s;
System.out.println(i + s);
}
}
}

Well now let's analyze your 'solution' shall we.

Agreed the 'specification' is a little lacking but as we are unable to
go back to the client at this time we need to make some assumptions.

Assumption 1. It's 'homework'

OK, now what do you imagine the learning objectives are?

Well it certainly looks 'loopy' so

Assumption 2. It's intended to get the student to learn about loop
control variables, possibly to control nested loops.
Hmm, perhaps it is, but that is an assumption. Notice the "Ass" and "U"
in that word?
The output is numeric so

Assumption 3. It's intended to exercise some understanding of
manipulation of numeric variables ...
So you're going to throw in modules arithmetic, number theory, multiple
variables, and avoid for-loops.
Well that's about it for the assumptions, now how does your solution
meet the objectives?

... ah yes, String concatenation in a for loop

1/10 for effort
Ultimate learning objective: Do things the simplest possible way.

Hint: Don't get bogged down on what it "looks like", but what it
actually is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top