Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

import class java

//Demo.java  
package pack;  

public class Demo {  
    public void msg() {
        System.out.println("Hello");
    }  
}  


//Test.java  
package mypack;  

import pack.Demo;  

class Test {  
    public static void main(String args[]) {  
        Demo obj = new Demo();  
        obj.msg();  
    }  
}
Comment

import class java

import package.myclass;
Comment

import class from package java

Package can have many classes but sometimes we want to access only specific class in our program in that case, Java allows us to specify class name along with package name. 
If we use import packagename.classname statement then only the class with name classname in the package will be available for use.
Comment

PREVIOUS NEXT
Code Example
Java :: is java pass by value or pass by reference 
Java :: java find largest number in list 
Java :: swapping techniques using java 
Java :: unicode in java 
Java :: java check if class is subclass 
Java :: binary search program in java 
Java :: check if string is decimal java 
Java :: java enum from int 
Java :: constructeur java 
Java :: java enum values() 
Java :: finding min and max from given number in java 
Java :: how to call child class method from parent class in java 
Java :: java format double no decimal places 
Java :: java get class by string name 
Java :: java font bold italic 
Java :: client missing intents 
Java :: bukkit e.getCurrentItem() bytes? 
Sql :: safe update mysql 
Sql :: uninstall mysql ubuntu 
Sql :: convert utc to est sql 
Sql :: wait delay in sql server 
Sql :: output oracle 
Sql :: create database if not exists 
Sql :: postgres kill running query 
Sql :: update password postgres user 
Sql :: postgresql add not null constraint 
Sql :: mysql show indexes on table 
Sql :: postgres set sequence value to max id 
Sql :: mysql last 6 months 
Sql :: tsql update datetime 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =