answersLogoWhite

0


Best Answer

You cannot do that. The main method of a java class is the point where the execution begins. You can print messages only after a main method is invoked.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you print message before main in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you print some message on the console without using main in java?

By using the static block


How do you print the message welcometomist in java?

class SecondProgram { public static void main(String args[]) { System.out.println(/welcome/to/mist } }


Write aprogram to print number between20 and30?

In Java, put the following within the main() method:for (int i = 20; i


Why main is used in java?

In java need main() method. without main() in java we won't run the java programe main() signals the entry point to the program - it tells the Java Virtual Machine which is the first program that should be executed.


How do you print a word before main function?

Do you mean something like this: static void Print (const char *s) { puts (s); } int main (void) { Print ("a word"); return 0; }


Who invoke main function in java?

The Java Runtime Environment invokes main methods.


Which api used in java?

The Java API is the API for the main Java Library.


C plus plus programs-print a message?

#include<iostream> int main() { std::cout << "Hello world!\n"; }


Is it possible to define a java static method inside a main method?

Because, the main method is the starting point of the java program and if we need an object of that class even before the main can be invoked, it is not possible. Hence it is declared static so that the JVM Can acess the main method without having to instantiate that particular class


Write in BlueJ to print lucky numbers?

To print lucky numbers in java, you must give the following program: class example { static public void main(String[] args) { System.out.println("Lucky number is your favourite number which is your DOB"); } }


Write a program in java programming language to print welcome to java programming?

public class welcome { public static void main (String args[]) { System.out.println("Welcome to Java programming"); } } There are also many "Hello World" tutorials you can find elsewhere on the internet


How do you call main class with in main class in java?

We can't call a class. We always call a method in java.