![]() |
|
One of my first Java Programs! - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Java, JVM, & JRE (https://sinister.li/Forum-Java-JVM-JRE) +--- Thread: One of my first Java Programs! (/Thread-One-of-my-first-Java-Programs) |
One of my first Java Programs! - RaccoonCity_mybb_import13707 - 10-24-2013 Hey, I'm very new to Java, I've been programming in some stages but I've always started fading into hacking again. Now, this is one basic program I did today, remember, I'm very new. ![]() Code: class Helloworld {
public static void main(String[]args){
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println(" _________________________________________________________________ ");
System.out.println(" HHHH HHHH AA CCCCCCC KK KK EEEEEEE RRRRRR ");
System.out.println(" HHHH HHHH AAAA CCC KK KK EE RR RRR ");
System.out.println(" HHHHHHHHHHHH AAAAAA CCC KK KK EEEEEEE RRRRRR ");
System.out.println(" HHHHHHHHHHHH AAA AAA CCC KKKK EEEEEEE RRRRRR ");
System.out.println(" HHHH HHHH AAAAAAAAA CCC KK KK EE RR RRR ");
System.out.println(" HHHH HHHH AAA AAA CCCCCCC KK KK EEEEEEE RR RRR ");
System.out.println(" _________________________________________________________________ ");
}
}I know the code got kind of screwed up, but if you paste it into a text document you'll probably see the code a bit better! Thanks, Zedex. One of my first Java Programs! - RaccoonCity_mybb_import13707 - 10-24-2013 Hey, I'm very new to Java, I've been programming in some stages but I've always started fading into hacking again. Now, this is one basic program I did today, remember, I'm very new. ![]() Code: class Helloworld {
public static void main(String[]args){
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println(" _________________________________________________________________ ");
System.out.println(" HHHH HHHH AA CCCCCCC KK KK EEEEEEE RRRRRR ");
System.out.println(" HHHH HHHH AAAA CCC KK KK EE RR RRR ");
System.out.println(" HHHHHHHHHHHH AAAAAA CCC KK KK EEEEEEE RRRRRR ");
System.out.println(" HHHHHHHHHHHH AAA AAA CCC KKKK EEEEEEE RRRRRR ");
System.out.println(" HHHH HHHH AAAAAAAAA CCC KK KK EE RR RRR ");
System.out.println(" HHHH HHHH AAA AAA CCCCCCC KK KK EEEEEEE RR RRR ");
System.out.println(" _________________________________________________________________ ");
}
}I know the code got kind of screwed up, but if you paste it into a text document you'll probably see the code a bit better! Thanks, Zedex. One of my first Java Programs! - RaccoonCity_mybb_import13707 - 10-24-2013 Hey, I'm very new to Java, I've been programming in some stages but I've always started fading into hacking again. Now, this is one basic program I did today, remember, I'm very new. ![]() Code: class Helloworld {
public static void main(String[]args){
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println(" _________________________________________________________________ ");
System.out.println(" HHHH HHHH AA CCCCCCC KK KK EEEEEEE RRRRRR ");
System.out.println(" HHHH HHHH AAAA CCC KK KK EE RR RRR ");
System.out.println(" HHHHHHHHHHHH AAAAAA CCC KK KK EEEEEEE RRRRRR ");
System.out.println(" HHHHHHHHHHHH AAA AAA CCC KKKK EEEEEEE RRRRRR ");
System.out.println(" HHHH HHHH AAAAAAAAA CCC KK KK EE RR RRR ");
System.out.println(" HHHH HHHH AAA AAA CCCCCCC KK KK EEEEEEE RR RRR ");
System.out.println(" _________________________________________________________________ ");
}
}I know the code got kind of screwed up, but if you paste it into a text document you'll probably see the code a bit better! Thanks, Zedex. RE: One of my first Java Programs! - Psycho_Coder - 10-24-2013 It is a good practice to declare your class with access modifiers like public class Helloworld. Also it is a convention to use title case on every meaningful word like you have named it Helloworld, I would have expected "HelloWorld" instead. Instead to using three separate System.out.println(""); to print different lines you could do the following: Code: System.out.print("\n\n\n");Note that '\n' is a character, for every \n a new line is printed. You have used many spaces to make your output message to the center. instead you can use '\t' which stands for tab. Also instead of using so many so many print statements you can print hacker using one only. Here's the re factored code Code: public class HelloWorld {
public static void main(String[] args) {
final String NEWLINE= "\n";
final String TAB = "\t\t\t\t\t\t";
System.out.print(
TAB+"HHHH HHHH AA CCCCCCC KK KK EEEEEEE RRRRRR" + NEWLINE +
TAB+"HHHH HHHH AAAA CCC KK KK EE RR RRR" + NEWLINE +
TAB+"HHHHHHHHHHHH AAAAAA CCC KK KK EEEEEEE RRRRRR" + NEWLINE +
TAB+"HHHHHHHHHHHH AAA AAA CCC KKKK EEEEEEE RRRRRR" + NEWLINE +
TAB+"HHHH HHHH AAAAAAAAA CCC KK KK EE RR RRR" + NEWLINE +
TAB+"HHHH HHHH AAA AAA CCCCCCC KK KK EEEEEEE RR RRR");
}
}output :- Code: HHHH HHHH AA CCCCCCC KK KK EEEEEEE RRRRRR
HHHH HHHH AAAA CCC KK KK EE RR RRR
HHHHHHHHHHHH AAAAAA CCC KK KK EEEEEEE RRRRRR
HHHHHHHHHHHH AAA AAA CCC KKKK EEEEEEE RRRRRR
HHHH HHHH AAAAAAAAA CCC KK KK EE RR RRR
HHHH HHHH AAA AAA CCCCCCC KK KK EEEEEEE RR RRRRE: One of my first Java Programs! - RaccoonCity_mybb_import13707 - 10-24-2013 (10-24-2013, 10:57 AM)Psycho_Coder Wrote: It is a good practice to declare your class with access modifiers like public class Helloworld. Oh, thank you! I didn't know that, really appriciated! RE: One of my first Java Programs! - RaccoonCity_mybb_import13707 - 10-24-2013 (10-24-2013, 10:57 AM)Psycho_Coder Wrote: It is a good practice to declare your class with access modifiers like public class Helloworld. Oh, thank you! I didn't know that, really appriciated! RE: One of my first Java Programs! - RaccoonCity_mybb_import13707 - 10-24-2013 (10-24-2013, 10:57 AM)Psycho_Coder Wrote: It is a good practice to declare your class with access modifiers like public class Helloworld. Oh, thank you! I didn't know that, really appriciated! RE: One of my first Java Programs! - blackeagle - 10-24-2013 @"Zedex" this is really easy just like the hello world program i did something similar first year at uni it was doing a face in the characters instead of writing hacker i did it the same way you've done it with many system.out.println but now thx to @Psycho_Coder i know that i could have done it in only one system.out.println RE: One of my first Java Programs! - blackeagle - 10-24-2013 @"Zedex" this is really easy just like the hello world program i did something similar first year at uni it was doing a face in the characters instead of writing hacker i did it the same way you've done it with many system.out.println but now thx to @Psycho_Coder i know that i could have done it in only one system.out.println RE: One of my first Java Programs! - blackeagle - 10-24-2013 @"Zedex" this is really easy just like the hello world program i did something similar first year at uni it was doing a face in the characters instead of writing hacker i did it the same way you've done it with many system.out.println but now thx to @Psycho_Coder i know that i could have done it in only one system.out.println |