Computer Science, asked by heroscrate, 10 months ago

Difference between Welcome.java and Welcome.class

Answers

Answered by PravinRatta
2

Welcome.class: Lines 2 defines the beginning of the welcome class. When declaring a class as public, it can be accessed and used by the other class. So, there is also an open brace which is to indicate the start of the scope of the class.

To declare a class here is the syntax:

<method>class<class_name>

Example: public class Welcome{

Welcome.java: In java, there is no provision to declare a class, and then define the member function outside the class. The body of every member of a class must be written when the method is declared. Java methods can be written in any order in the source file. A method defined earlier in the source file which can call a method defined later.

Example:  

public class Welcome

{

    public static void main ( strings args[])

{  

     system.out.print( "Welcome");

     system.out.print( "to" );

     system.out.println( "Java!");

     system.out.println( "Welcome "+ "to "+" Java!");

}

}

Output: Welcome to Java!

   

Answered by smartbrainz
0

Difference between Welcome.java and Welcome.class:

  • The Java files are stored with the extension '.java' in common text files. The file extension of a Java ASCII text file is . java. It makes Java compiler to spot Java source files once you execute * command like javac *. java.
  • The word 'class' is jargon for defining a new class and Welcome is a class name. The 'class' definition must start with the curly brace opening ( { ) and end with the curly brace closing ( } ). All the activities of the program are described within the class.

To know more

Name any four tokens of Java?.........

https://brainly.in/question/2252155

Name three packages of java class library

https://brainly.in/question/2856436

Similar questions