Question

In: Computer Science

Print "Hello World" in the most complicated way (java)

Print "Hello World" in the most complicated way (java)

Solutions

Expert Solution

Solution

Screenshot

Code

class HelloText implements Runnable
{
public void run(){
char l = ' ';
char[] h = new char[6];
int o = 0, m = 0, n = 0;
int[] k = {104, 101, 108, 108, 111, 32};
for (int i = h.length-1; i > -1; i--){
h[i] = (char) k[o++];
System.out.print(h[i]);
}
}
}

class WorldText implements Runnable
{
public void run()
{
int k = 100;
char kkkkkk = (char) 100+10+9;
char kkkkk = (char) 3*((2*15)+7);
char kkkk = (char) Math.sqrt(12996);
char kkk = (char) 0+(-1)+108+(1)*1;
char kk = (char) k;
  
System.out.println(kkkkkk+""+kkkkk+kkkk+kkk+kk);
}
static int excla(){
int i = (int) Math.pow(3,3)+6;
return i;
}
}
public class Main
{
public static void main(String[] args)
{
Thread worldt = new Thread(new HelloText());
Thread hellot = new Thread(new WorldText());
try
{
worldt.start();
worldt.join();
hellot.start();
hellot.join();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

Output

---

all the best


Related Solutions

Modify the following source code so that five subsequent threads print the message “Hello World number,”...
Modify the following source code so that five subsequent threads print the message “Hello World number,” where number indicates the unique thread created; e.g. “Hello World 1” // Your_name_goes_here #include <pthread.h> #include <semaphore.h> sem_t semaphore; // also a global variable just like mutexes void *thread_function( void *arg ) { sem_wait( &semaphore ); // perform some task pthread_exit( NULL ); } int main() { int tmp; tmp = sem_init( &semaphore, 0, 0 ); // initialize pthread_create( &thread[i], NULL, thread_function, NULL );...
C++: How are std::cout << “hello world” and std::cout << “hello” << ‘ ‘ << “world”...
C++: How are std::cout << “hello world” and std::cout << “hello” << ‘ ‘ << “world” different?
I NEED IT PRINT IN THIS FORM JAVA How is a Java source file executed? 1....
I NEED IT PRINT IN THIS FORM JAVA How is a Java source file executed? 1. It is compiled and runs natively 2. It is interpreted but not compiled 3. It is compiled into byte code and executed by the Java Virtual Machine 4. It is magic Please enter your answer 1 Sorry that answer is not correct. The correct answer is 3 Correct output: How is a Java source file executed? 1. It is compiled and runs natively 2....
Psychotic disorders and schizophrenic disorders are some of the most complicated and challenging diagnoses in the...
Psychotic disorders and schizophrenic disorders are some of the most complicated and challenging diagnoses in the DSM. The symptoms of psychotic disorders may appear quite vivid in some clients; whereas, within other clients, symptoms may be barely observable. Additionally, symptoms may overlap among disorders. For example, specific symptoms such as neurocognitive impairments, social problems, and illusions may exist in schizophrenic clients, but are also contributing symptoms for other psychotic disorders. For this Discussion, consider whether experiences of psychosis-related symptoms are...
(Java Zybooks) Print "Censored" if userInput contains the word "darn", else print userInput. End with newline....
(Java Zybooks) Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn cat.", then output is: Censored Ex: If userInput is "Dang, that was scary!", then output is: Dang, that was scary! Note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message....
Hello, ***We have to print the second list backward while interleaved with the first list in...
Hello, ***We have to print the second list backward while interleaved with the first list in normal order.*** its PYTHON language. Please refer the below example. Bold are the inputs that the user enters. In here the user input words and much as he wants and when he enter STOP, it stops and he is asked to enter more words.(second words count equals to the word count he inputs in the first phase) Enter words, STOP to stop. Ok Enter...
Write a complete Java program to print out the name bob
Write a complete Java program to print out the name bob
I need it in java. Write a program that will print if n numbers that the...
I need it in java. Write a program that will print if n numbers that the user will input are or not within a range of numbers. For that, your program needs to ask first for an integer number called N that will represent the number of times that will ask for other integer numbers. Right after, it should ask for two numbers that will represent the Min and Max for a range. Lastly. it will iterate N number times...
Hello, How can I make the program print out "Invalid data!!" if the file has a...
Hello, How can I make the program print out "Invalid data!!" if the file has a grade that is not an A, B, C, D, E, or F or a percentage below zero. The program should sort a file containing data about students like this for five columns: one for last name, one for first name, one for student ID, one for student grade percentage, one for student grade. Smith Kelly 438975 98.6 A Johnson Gus 210498 72.4 C Reges...
in java Print a list of seats in a theater. Rows are numbered, columns lettered, as...
in java Print a list of seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print a space after each seat. Create a nested loop to print the following: 1A 1B 1C 1D 3A 3B 3C 3D 5A 5B 5C 5D
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT