Core java Basic

Ads
 

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?

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

Ads









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  write java program to evaluate 1+x^2+x^3+x^4+............+x^n
Java basic
Java basic  How can I Use Eclipse to create a project and write a hello world java application
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
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
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
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
Version of com.17jee>e-core-basic dependency
List of Version of com.17jee>e-core-basic dependency
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
top 20 basic programm of java
top 20 basic programm of java  what is the top 20 rule to learn the basic of java.   Learn Java through the following links: http://www.roseindia.net/java/ http://www.roseindia.net/java/beginners/index.shtml
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 problem for Java experts
Basic problem for Java experts  This assignment will test your knowledge of Arrays Array searching Array sorting Array processing Specification An athletics club require a simple statistical analysis program for analysing lap
What are Basic Java Language Elements?
What are Basic Java Language Elements?  Hello, I have learned to setup Java and create first program. I want to know the Basic Java Language Elements. What are Basic Java Language Elements? Which is good tutorials of Java
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan... its right time to learn Java, web programming and make career in Software field. Is it possible to learn basic Java in a month? Thanks
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan... its right time to learn Java, web programming and make career in Software field. Is it possible to learn basic Java in a month? Thanks
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan... its right time to learn Java, web programming and make career in Software field. Is it possible to learn basic Java in a month? Thanks
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan... its right time to learn Java, web programming and make career in Software field. Is it possible to learn basic Java in a month? Thanks
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan... its right time to learn Java, web programming and make career in Software field. Is it possible to learn basic Java in a month? Thanks
Is it possible to learn basic Java in a month?
Is it possible to learn basic Java in a month?  Hi, I am big fan... its right time to learn Java, web programming and make career in Software field. Is it possible to learn basic Java in a month? Thanks
Maven Dependency e-core-basic >> 3.0.0.RELEASE
You should include the dependency code given in this page to add Maven Dependency of com.17jee >> e-core-basic version3.0.0.RELEASE in your project
Core Java - Java Beginners
talk about core java, we means very basic or from the scratch where you learn about...Core Java  What is Java? I am looking for Core Java Training  Hi friendThe Core Java Technologies and application programming interface
core java
core java  how to display characters stored in array in core java
CORE JAVA
CORE JAVA  CORE JAVA PPT NEED WITH SOURCE CODE EXPLANATION CAN U ??   Core Java Tutorials
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

Ads