Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Core java Basic
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Robin Sharma
Core java Basic
1 Answer(s)      3 years and 11 months ago
Posted in : Java Beginners


How to compile a program using the package statement at the first line.Do I have to create a a Seperate Folder with the name of the package in my directory.Please tell me the steps?


Advertisement
View Answers

January 14, 2011 at 3:53 PM


Hi Friend,

Follow these steps:

1)Create folder named form in C:/Examples/ folder.

2)Create a java class Calculate inside the form folder:

package form;
public class Calculate
{
public int a;
public int b;

public int add(int a,int b){
    return a+b;
}
}

3)Now to check this, create another class CallClass inside the Examples folder that will call the Calculate class.

public class CallClass{
    public static void main(String[] args) 
    {
        form.Calculate c=new form.Calculate();
        System.out.println(c.add(5,6));
    }
}

4)Compile the Calculate and CallClass class with the following statements:

C:\Examples\form>javac Calculate.java
C:\Examples>javac CallClass.java
C:\Examples>java CallClass

Thanks



Related Tutorials/Questions & Answers:
java core basic problem
java core basic problem  my question is: write a program that illustrates interface inheritance. interface P is extended by P1 and P2. interface... methode. class Q impliments P12 Instantiate Q and invoke each of its methods.Each
java core basic problem
java core basic problem  my question is: write a program that illustrates interface inheritance. interface P is extended by P1 and P2. interface... methode. class Q impliments P12 Instantiate Q and invoke each of its methods.Each
Advertisements
Core java Basic
Core java Basic  How to compile a program using the package statement at the first line.Do I have to create a a Seperate Folder with the name of the package in my directory.Please tell me the steps
core java
core java  basic java interview question
java basic
java basic  Java Basics tutorials
java basic
java basic  java program for finding LCM and HCF
Java basic
Java basic  How can I Use Eclipse to create a project and write a hello world java application
java basic
java basic  write java program to evaluate 1+x^2+x^3+x^4+............+x^n
java basic
java basic  i need to give a hexadecimal input (0x71014802 and 0x8c2a0000) and want to get a MIPS instruction code(assembly level lang.):the output is not a matter... i want to create a package and then input converted converted
Core Java tutorial for beginners
. Core Java is where the basic parts of Java are explained while Advanced Java... Core Java tutorials for beginners makes its simpler for novices to learn the basic of Java language. In order to make it simpler to understand
Core Java Tutorial for Beginners
Core Java tutorials for beginners help you to learn the language in an easy way giving you simple examples with explanation. Core Java is the basic of Java... Desktop applications. Core java is all the basic classes and APIs that make
basic java - Java Beginners
basic java  oops concept in java ?  Hi Friend, Please visit the following links: http://www.roseindia.net/java/beginners/oop-in-java.shtml http://www.roseindia.net/java/learn-java-in-a-day/oops.shtml Thanks
core java
core java  how to display characters stored in array in core java
Basic Java Tutorial
Basic Java Tutorial  Hi, Where is the url of Basic Java Tutorials on roseindia.net? Thanks   Hi, You can Learn Java in a Day also? Thanks
java and visual basic
java and visual basic  Hello, Please how does java and visual basic interact or talk
CORE JAVA
CORE JAVA  CORE JAVA PPT NEED WITH SOURCE CODE EXPLANATION CAN U ??   Core Java Tutorials
core java
core java  i need core java material   Hello Friend, Please visit the following link: Core Java Thanks
core java
core java  Hi, can any one expain me serialization,Deseralization and exterenalization in core java
core java
core java  Hi, can any one exain me the concept of static and dynamic loading in core java
Java basic question...
Java basic question...   Design a Java Application project...), emp_desig as String (To hold designation of the employee) and basic as Integer (To hold the basic salary of the employee). (iii) Define and declare a method
BASIC Java - Java Tutorials
Basic Java Syntax This tutorial guide you about the basic syntax of the java... of the java which is applicable to all java program : Case Sensitive Java Java... letter and lover case. For example, case and Case are different words in java
Core JAva
Core JAva  how to swap 2 variables without temp in java
core java
core java  how can we justify java technology is robust
CORE JAVA
CORE JAVA  What is Garbage collection in java? What is the role of a developer for garbage collection
core java
core java  its compulsory to save file name and class name is same in java
Core Java
Core Java  How to execute cmd command through java?? Give Code of them
core java
core java  write a java program to view product details from product table
Core Java
Core Java  Hi, Can any one please share the code for Binary search in java without using builtin function
Core Java
Core Java  Please write a Java Program to design login form and store the values in file & validate and display the MainForm
core java
core java  In java primitive variables will get its default value automatically after declaration. Then why it is mandatory to initialize a variable before using
core java
core java  Hello sir,What is logic behinde the core java programms,How may programmas are there,for example,sorting of two numbers,grade of the student details,fibonice serice,paldroma,incremting of the program,asscedding
Advertisements
 

 

 

DMCA.com