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?

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
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
Maven dependency for com.17jee - e-core-basic version 3.0.0.RELEASE is released. Learn to use e-core-basic version 3.0.0.RELEASE in Maven based Java projects
-core-basic version 3.0.0.RELEASE in Java projects. Follow the step by step...-basic released The developers of   com.17jee - e-core-basic project... version of  com.17jee - e-core-basic library is 3.0.0.RELEASE. Developer can
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
Version of com.17jee>e-core-basic dependency
List of Version of com.17jee>e-core-basic dependency
java and visual basic
java and visual basic  Hello, Please how does java and visual basic interact or talk
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
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... in java, the first letter of class should be in the upper case. All the other
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 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
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
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
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for e-core-basic version 3.0.0.RELEASE
com.17jee:e-core-basic:3.0.0.RELEASE Java library in your project.. Maven, Gradle, SBT, Ivy, Grape, Leiningen and  Buildr Dependency for e-core-basic..., Gradle, SBT, Ivy, Grape, Leiningen and  Buildr Dependency for e-core-basic
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 Repository/Dependency: com.17jee | e-core-basic
Maven Repository/Dependency of Group ID com.17jee and Artifact ID e-core-basic. Latest version of com.17jee:e-core-basic dependencies. # Version Release Date 1 3.0.0.RELEASE
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
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
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
core java
core java  basic java interview question
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
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
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
Basic Java programming for Beginners
Basic Java programming for Beginners helps them to learn the fundamentals of the language easily and quickly. Java is an Object Oriented Programming language... programming. Basic Java tutorials of Roseindia help all those by giving them
basic html
basic html  what is the difference between html4 and html5
Maven dependency for net.mingsoft - ms-basic version 2.1.13 is released. Learn to use ms-basic version 2.1.13 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.13 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 2.1.13 in Java...; net.mingsoft - ms-basic version 2.1.13 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 2.1.13.1 is released. Learn to use ms-basic version 2.1.13.1 in Maven based Java projects
this version ( net.mingsoft - ms-basic version 2.1.13.1 ) in their Java project... and includes  net.mingsoft - ms-basic version 2.1.13.1 java library in your project...Maven dependency for  net.mingsoft  - Version 2.1.13.1 of ms-basic
Maven dependency for net.mingsoft - ms-basic version 2.1.13.2 is released. Learn to use ms-basic version 2.1.13.2 in Maven based Java projects
this version ( net.mingsoft - ms-basic version 2.1.13.2 ) in their Java project... and includes  net.mingsoft - ms-basic version 2.1.13.2 java library in your project...Maven dependency for  net.mingsoft  - Version 2.1.13.2 of ms-basic
Maven dependency for net.mingsoft - ms-basic version 2.1.12 is released. Learn to use ms-basic version 2.1.12 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.12 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 2.1.12 in Java...; net.mingsoft - ms-basic version 2.1.12 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 2.1.11 is released. Learn to use ms-basic version 2.1.11 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.11 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 2.1.11 in Java...; net.mingsoft - ms-basic version 2.1.11 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 2.1.16 is released. Learn to use ms-basic version 2.1.16 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.16 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 2.1.16 in Java...; net.mingsoft - ms-basic version 2.1.16 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 2.1.15 is released. Learn to use ms-basic version 2.1.15 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.15 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 2.1.15 in Java...; net.mingsoft - ms-basic version 2.1.15 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 2.1.10 is released. Learn to use ms-basic version 2.1.10 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.10 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 2.1.10 in Java...; net.mingsoft - ms-basic version 2.1.10 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 1.0.25 is released. Learn to use ms-basic version 1.0.25 in Maven based Java projects
( net.mingsoft - ms-basic version 1.0.25 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 1.0.25 in Java...; net.mingsoft - ms-basic version 1.0.25 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 2.1.14.1 is released. Learn to use ms-basic version 2.1.14.1 in Maven based Java projects
this version ( net.mingsoft - ms-basic version 2.1.14.1 ) in their Java project... and includes  net.mingsoft - ms-basic version 2.1.14.1 java library in your project...Maven dependency for  net.mingsoft  - Version 2.1.14.1 of ms-basic
Maven dependency for net.mingsoft - ms-basic version 2.1.14 is released. Learn to use ms-basic version 2.1.14 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.14 ) in their Java project... in project? Steps to use  net.mingsoft - ms-basic version 2.1.14 in Java...; net.mingsoft - ms-basic version 2.1.14 java library in your project. ADS
Maven dependency for net.mingsoft - ms-basic version 2.1.8 is released. Learn to use ms-basic version 2.1.8 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.8 ) in their Java project if it is based... in project? Steps to use  net.mingsoft - ms-basic version 2.1.8 in Java... - ms-basic version 2.1.8 java library in your project. ADS_TO_REPLACE_2 Now
Maven dependency for net.mingsoft - ms-basic version 2.1.7 is released. Learn to use ms-basic version 2.1.7 in Maven based Java projects
( net.mingsoft - ms-basic version 2.1.7 ) in their Java project if it is based... in project? Steps to use  net.mingsoft - ms-basic version 2.1.7 in Java... - ms-basic version 2.1.7 java library in your project. ADS_TO_REPLACE_2 Now

Ads