You are on page 1of 28

strictfp

• Java strictfp keyword ensures that you will get the


same result on every platform if you perform
operations in the floating-point variable.
• The precision may differ from platform to
platform that is why java programming language
have provided the strictfp keyword, so that you
get same result on every platform.
• So, now you have better control over the
floating-point arithmetic.
Illegal code for strictfp keyword
• The strictfp keyword cannot be applied on
abstract methods, variables or constructors.
Packages in java

Sadia Parveen
• Package in java can be categorized in two
form,
1. Built-in package
such as java, lang, awt, javax, swing, net, io, util, sql
etc.
2. User-defined package.
Advantage of Java Package
1) Java package is used to categorize the classes
and interfaces so that they can be easily
maintained.
2) Java package provides access protection.
3) Java package removes naming collision.
Access the package
• There are three ways to access the package
from outside the package.
1. import package.*;
2. import package.classname;
3. fully qualified name.
Access Modifiers in java
Access Modifiers in java

• There are two types of modifiers in java:


1. Access modifiers
a) private
b) default
c) protected
d) public
2. Non-access modifiers.
static, abstract, synchronized, native, volatile,
transient
public access modifier
private access modifier
class A{
private int data=40;
private void msg(){System.out.println("Hello java");}
}

public class Simple{


public static void main(String args[]){
A obj=new A();
System.out.println(obj.data);//Compile Time Error
obj.msg();//Compile Time Error
}
}
default access modifier
protected access modifier

You might also like