Interfaces And Packages In JAVA

48 %
52 %
Information about Interfaces And Packages In JAVA
Entertainment

Published on October 23, 2014

Author: arunkumarm526

Source: authorstream.com

Interfaces And Packages In JAVA: Interfaces And Packages In JAVA BY: VINAY C (12YCSB6043) B C A 5 th Sem Interface: Interface In the Java programming language, an interface is a reference type, similar to a class, that can contain only constants, method signatures, and nested types. There are no method bodies. Interfaces cannot be instantiated They can only be implemented by classes or extended by other interfaces. Defining Interface: Defining Interface access interface interfacename { return-type methodname(parameter-list ); type final varname=value ; } Access is either public or not used . Methods are declared have no bodies and essentially abstract method. Each class that includes an interface must implement all of the methods . Variables are implicitly final and static, meaning they can't be change by the implementing class. Implementing Interface: Implementing Interface Class classname implements Interfacename { body of classname } Uses of Interfaces: Uses of Interfaces Interfaces are useful for the following: Capturing similarities between unrelated classes without forcing a class relationship . Declaring methods such that one or more classes are expected to implement . Revealing an object's programming interface without revealing its class Summary of Interfaces: Summary of Interfaces An interface defines a protocol of communication between two objects. An interface declaration contains signatures, but no implementations, for a set of methods, and might also contain constant definitions. A class that implements an interface must implement all the methods declared in the interface. Packages: Packages Definition :   A package is a grouping of related types (class, interface) providing access protection and name space management. Defining a package : package package -name; Importing a package : import packagename.classname ; or import packagename.*; Naming convention : double y = java.lang.Math.sqrt (x); package class method Creating and Using Packages: Creating and Using Packages Example for creating package Class Member Access table: private No modifier Protected Public Same class Yes Yes Yes Yes Same package subclass No Yes Yes Yes Same package non-subclass No Yes Yes Yes Different package subclass No No Yes Yes Different package non-subclass No No No Yes Slide 9: THANK YOU

Add a comment

Related presentations

Related pages

Java - Packages - Tutorials Point

Java Packages Learning Java in simple and easy steps : ... Java - Interfaces; Java - Packages; Java Advanced; Java - Data Structures; Java - Collections;
Read more

What Is a Package? (The Java™ Tutorials > Learning the ...

A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different ...
Read more

Java Packages and interface - SAP ERP Modules, Basis, ABAP ...

Java Packages and interface. 1) What are packages ? What is use of packages ? Ans :The package statement defines a name space in which classes are stored ...
Read more

Creating and Using Packages (The Java™ Tutorials ...

Creating and Using Packages. Creating a Package. Naming a Package. Using Package Members. ... //in the Draggable.java file public interface Draggable ...
Read more

Java package - Wikipedia, the free encyclopedia

A Java package is a technique for organizing Java classes into namespaces similar to the modules of ... (and interfaces) ... Core packages in Java SE 6
Read more

java packages and interfaces - Stack Overflow

Join the Stack Overflow community to: Ask programming questions Answer and help your peers Get recognized for your expertise
Read more

Day 16 -- Packages and Interfaces - Oddelenie ...

Packages and interfaces are two capabilities that allow you greater control and flexibility in designing sets of interrelated classes. Packages allow you ...
Read more

Java - Interfaces - Tutorials Point

Java Interfaces Learning Java in simple and easy steps : A beginner's tutorial containing complete ... package java.util; public interface EventListener ...
Read more

Java Package - javatpoint - Javatpoint - A Solution of all ...

Note: If you import a package, subpackages will not be imported. If you import a package, all the classes and interface of that package will be imported ...
Read more