Write a method called powersOfTwo that prints the first 10 powers of 2 (starting with 2). The method takes no parameters and doesn't return anything.
```
public void powersOfTwo()
{
int base = 2;
for (int power = 1; power <= 10; power++)
System.out.println(Math.pow(base,power));
}
```
```
public void powersOfTwo()
{
int num = 2;
for (int power = 1; power <= 10; power++)
{
num *= 2;
System.out.println(num);
}
}
```
You might also like to view...
In the following code, which of the following represents the line of code that guarantees that the variable m_name cannot be directly accessed from outside a Student object?
``` Class Student Private m_name As String Public Property Name() As String Get Return m_name End Get Set(Value As String) m_name = Value End Set End Property End Class ``` (A) End Class (B) m_name = Value (C) Return m_name (D) Private m_name As String
Answer the following statements true (T) or false (F)
1. During the 1960s and much of the 1970s, most computer systems were interactive. 2. There are two basic types of IBM/OS JCL statements. 3. JOB statements separate and identify jobs. 4. EXEC (or execute) statements identify the programs (or job steps) to be executed. 5. DD (or data definition) statements define, in detail, the characteristics of each and every peripheral device used by each job step.
The ________ function isolates a specific portion of a date, such as the day, month, or year, in a date field
A) DateArithmetic B) DateDiff C) Date D) DatePart
To place a bibliography created in Word into a slide in a PowerPoint presentation, select the bibliography in Word and click the copy button then open the presentation and with the insertion point on a blank slide click ________
A) export B) paste special C) paste D) paste link