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 :: springboot avoid generated security password: 
Java :: explain java coding standards for classes 
Java :: convert array to arraylist 
Java :: code to get date and time in android 
Java :: Black belt in grepper 
Java :: for var i = 0 
Java :: java button with jpg image 
Java :: multiple root tags android manifest 
Java :: $950 at 6% per annum for three years. 
Java :: ticket sales java program 
Java :: selenium firefox to foreground -python java 
Sql :: sql developer search all packages for text 
Sql :: mysql how to truncate table with foreign keys 
Sql :: brew restart mysql 
Sql :: GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 
Sql :: Failed to stop mysqld.service: Unit mysqld.service not loaded. 
Sql :: fetch first 5 rows in oracle sql developer 
Sql :: mysql 3 months ago 
Sql :: ci last query 
Sql :: force drop all tables postgres 
Sql :: postgres remove database 
Sql :: pdo mysql insert 
Sql :: sql add date hour 
Sql :: mysql first day of month 
Sql :: psql get sequences 
Sql :: mysql find most common value 
Sql :: postgresql search all tables for column name 
Sql :: CREATE DATABASE db; SyntaxError: Unexpected identifier 
Sql :: mysql 8 error on identified by 
Sql :: check all sequences oracle sql 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =