aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes This file looks weird, but it compiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "This file looks weird, but it compiles" Watch "This file looks weird, but it compiles" New topic
Author

This file looks weird, but it compiles

Joe Allen
Ranch Hand

Joined: Nov 14, 2012
Posts: 93
import java.io.*;

abstract interface Veloz { void metodo(String x); }
public class A {
private abstract interface Veloz{ Number metodo(int x); }
abstract static class B{
private abstract static interface Veloz{void metodo(long x) throws Exception;}
public void metodo(){
class Opa implements Veloz{
public void metodo(long x) throws IOException { }
}
}
}
public void test(){
class Opa2 implements Veloz{
public Integer metodo(int x) throws RuntimeException {
return (Integer)(int) .5f;
}
}
}
}
===========================
private abstract static interface?
abstract static class?
I don't understand. Hopefully I don't get all confused and messed up before taking the exam.


"There are no dumb questions" quoted from HFSJ. "To err is human; to forgive is divine"
OCPJP 6, OCEJWCD 6
Zhenyi Luo
Ranch Hand

Joined: Sep 03, 2012
Posts: 33
Joe Allen wrote:import java.io.*;

abstract interface Veloz { void metodo(String x); }
public class A {
private abstract interface Veloz{ Number metodo(int x); }
abstract static class B{
private abstract static interface Veloz{void metodo(long x) throws Exception;}
public void metodo(){
class Opa implements Veloz{
public void metodo(long x) throws IOException { }
}
}
}
public void test(){
class Opa2 implements Veloz{
public Integer metodo(int x) throws RuntimeException {
return (Integer)(int) .5f;
}
}
}
}
===========================
private abstract static interface?
abstract static class?
I don't understand. Hopefully I don't get all confused and messed up before taking the exam.


Interfaces can be members of class definitions and can be declared private or protected there. Inner class is similar.
Robert Kristofic
Greenhorn

Joined: Nov 26, 2012
Posts: 1

class in class which is static is static nested class (not static is inner class).

Nested classes
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: This file looks weird, but it compiles