Hi everybody!
As was suggested here, today should be Hello World Day! So, here's my Hello World Program in Java: - import java.util.*;
-
public class HelloWorldDay {
-
public static void main(String[] args) {
-
ArrayList<Character> al = new ArrayList<Character>();
-
char[] array = {'H', '!', 'e', 'd', 'l', 'l', 'l', 'r', 'o', 'o', ' ', 'W'};
-
for(int i=0; i<array.length/2; i++) {
-
al.add(i,array[i*2]);
-
}
-
for(int i=array.length-1; i>=0; i-=2) {
-
al.add(al.size(),array[i]);
-
}
-
for(int i=0; i<al.size(); i++)
-
System.out.print(al.get(i));
-
}
-
}
Greetings,
Nepomuk
PS.: This Thread will be unstuck tomorrow, so don't worry dear fellow mods.
2 1138
For our international friends, - import java.util.ArrayList;
-
import java.util.Random;
-
import java.util.Scanner;
-
-
public class HelloWorldDay {
-
private static ArrayList<String> greetings;
-
-
public static void main(String[] args) {
-
load();
-
String response;
-
Random gen = new Random();
-
Scanner console = new Scanner(System.in);
-
-
do {
-
System.out.println(greetings.get(gen.nextInt(greetings.size())));
-
System.out.print("Again? ");
-
response = console.nextLine();
-
} while (response.equals("YES") || response.equals("Yes") || response.equals("yes"));
-
}
-
-
public static void load() {
-
greetings = new ArrayList<String>();
-
greetings.add("Hello, World!"); // English
-
greetings.add("Guten Tag, Welt!"); // German
-
greetings.add("Hola, Mundo!"); // Spanish
-
greetings.add("Bonjour, Monde!"); // French
-
greetings.add("Hola món!"); // Catalan
-
greetings.add("Ahoj, svete!"); // Czech
-
greetings.add("Hei, maailma!"); //Finnish
-
greetings.add("Salve, munde!"); // Latin
-
}
-
}
Just add your language if I don't have it!
- //...
-
greetings.add("Salve, munde!"); // Latin
-
//...
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Andy Sutorius |
last post by:
Has anyone successfully created a Hello World program without using Visual
Studio.NET? If so, what IDE did you use and what namespaces did you import?
Thanks!
Andy Sutorius
|
by: ME |
last post by:
I am trying to find a prewritten method for converting a string like
this:"Hello World" to this "Hello\sWorld". I plan to use it to build a
regular expression. Specifically I am looking for a...
|
by: Tim Judd |
last post by:
I must not be grasping anything here.
Just a simple application, as follows (as any first-program is...)
----
#include <iostream.h>
int main() {
cout <<"hello world";
return 0;
|
by: RC |
last post by:
Hello World,
I am try do call a JavaScript function from XSLT, but I got
function not avaible error. See "????" below.
Would someone out there tell me how?
Thank Q!
<xsl:stylesheet...
|
by: vijay |
last post by:
Hello,
As the subject suggests, I need to print the string in the reverse
order. I made the following program:
# include<stdio.h>
struct llnode
{
char *info;
|
by: arnuld |
last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to
remove some parts of programme and experiment with error, so here i
go:
#include <stdio.h>
int main () {
printf('hello...
|
by: C.W.Holeman II |
last post by:
As K&R state the hardest part is getting a first instance to work. So I am
looking for a "hello, world!" example for adding an additional element
to an XHTML file.
<html>
<head><title>Hello,...
|
by: James T. Dennis |
last post by:
You'd think that using things like gettext would be easy. Superficially
it seems well documented in the Library Reference(*). However, it can
be surprisingly difficult to get the external details...
|
by: cj |
last post by:
Perhaps someone knows how to do this. When I open a new ASP.NET web
service application in VS 2008, it opens with a simple Hello World web
service already written. I want to see this work. ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |