Core java Basic

Ads

 
 

Share on Google+Share on Google+

Robin Sharma
Core java Basic
1 Answer(s)      6 years and 8 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?

Ads
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
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
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
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
Version of com.17jee>e-core-basic dependency
List of Version of com.17jee>e-core-basic dependency
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
core java
core java  basic java interview question
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
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
Basic on J2ee - Java Beginners
Basic on J2ee  J2EE is a platform that helps us to develop and deploy enterprise application.It follows the component based architecure. So, it means that an application is developed in components in order to acheive reusability
java basic - Development process
java basic  Hi, I write a program for printing string n no of times.i gave string in console.if i gave '&' or '|' or '>' or '<'.so i want... for solving the problem and visit to : http://www.roseindia.net/java/beginners
Java Basic - Applet
Java Basic  My Applet Programs are Compiling as well as Running properly. But when I close the Applet window I am getting an Error Message as: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException and also 10
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
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
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
basic  thank you sir for your nice reply . ......sir my next que, if java program is modified,if the program is compiled & executed without saving it again,its previous execution takes place,why
Java Basic Tutorial for Beginners
Java Basic Tutorial for Beginners - Learn how to setup-development environment and write Java programs This tutorial will get you started with the Java... in Java who wants to get started with Java. After completing these tutorial you
Basic Java programming for Beginners
Basic Java programming for Beginners helps them to learn the fundamentals... programming. Basic Java tutorials of Roseindia help all those by giving them... the lectures and it will step-by-step take you from basic to advance level of Java
core java
core java  how to display characters stored in array in core java
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  i need core java material   Hello Friend, Please visit the following link: Core Java Thanks
CORE JAVA
CORE JAVA  CORE JAVA PPT NEED WITH SOURCE CODE EXPLANATION CAN U ??   Core Java Tutorials