You've successfully subscribed to The Poor Coder | Hackerrank Solutions
Great! Next, complete checkout for full access to The Poor Coder | Hackerrank Solutions
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.

## Hackerrank Can You Access? Solution

Beeze Aal

You are given a class Solution and an inner class Inner.Private. The main method of class Solution takes an integer  as input. The powerof2 in class Inner.Private checks whether a number is a power of . You have to call the method powerof2 of the class Inner.Private from the main method of the class Solution.

Constraints

Sample Input

8


Sample Output

8 is power of 2
An instance of class: Solution.Inner.Private has been created


### Solution in java8

Approach 1.


o = new Inner().new Private();
System.out.printf("%d is %s \n",num,((Inner.Private)o).powerof2(num));
//Write your code here



Approach 2.



System.out.println(num + " is " + ((Solution.Inner.Private)(o = (Object) new Solution.Inner().new Private())).powerof2(num));



Approach 3.



//Write your code here
o = new Inner().new Private();
System.out.println(num + " is " + ((Solution.Inner.Private)o).powerof2(num));