Total members 11889 |It is currently Tue Apr 16, 2024 8:50 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Executing a Java Program :
Is it your first time to write code in Java.Suppose your wrote the following Java class and you want to run it .

Learn.java File
java code
package codemiles;

public class Learn {

String LessonTitle;
public Learn(String Title)
{
LessonTitle=Title;
}

public static void main(String[] args)
{

Learn myLesson=new Learn("Java Programming");
myLesson.printTitle();

}

public void setLeasonTitle(String LessonTitle) {
this.LessonTitle = LessonTitle;
}

public String getLessonTitle() {
return LessonTitle;
}
public void printTitle()
{
System.out.println("Lesson Title: "+LessonTitle);
}

}


The First case you will run it from the command line in your operating system . In Java the compiler compiles the code into a bytwcode which is not executable . Bytecode is somewhere in the middle of source code and executable code.

To create a bytecode :

Code:
javac Learn.java


After this step a bytecode will be generated as Learn.class .

To execute write :

Code:
java Learn


the output will be the following :
Code:
Lesson Title:  Java Programming




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Executing a Java Program
 java program     -  
 java program     -  
 java chat program.     -  
 email through JAVA program     -  
 compiling and getting of a java program     -  
 Elements of a Java Program     -  
 Java Chat Program between two computers     -  
 Java Program for communicate PC and Mobile     -  
 Need Java program for display the CPU usage     -  
 uploading text file to java program     -  



Topic Tags

Java Basics
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com