OK, so I'm pretty sure I'm just missing something really dumb here, but for a coding assignment, I need to create a public class called 'Android' and give it instance variables and methods that meet the specifications.
I keep getting the error:
File: C:\Users\somerandomuser\Desktop\hmwk\Android.java [line: 35] Error: Cannot make a static reference to the non-static field tag
Here's my Android class:
import java.util.*;
public class Android
{
private int tag;
private String name;
public Android()
{
name = "Bob"+tag;
tag = changeTag();
}
public String getName()
{
return name;
}
private static boolean isPrime(int n)
{
//random magic bullshit goes here....
int i;
for (i=2; i<n;i++) {
if (n%i==0)
return false;
}
return true;
}
private static int changeTag()
{
//advanced magic bullshit goes here....
boolean exit = false;
int query = tag;
while (!exit)
{
exit=isPrime(query);
if (!exit)
{
query++;
}
else
{
int x;
}
}
}
public int getTag()
{
return tag;
}
}
Thanks ahead of time!