I don't know what pot I was smoking when I posted the original, but I came to my senses and came up with this. I am not an experienced coder, but the entire post was made mostly as a question that for the most part has been answered. I now know classes can't have code directly in them, and more so about the core structure.
class Shape {
public static void ShapeAttemptTwo()
{
class Circle extends Shape
{
public static CircleAttemptTwo()
{
int pi = 3.14;
int r=4;
}
}
class Rectangle extends Shape
{
public static Rectangle()
{
int l = 14;
int b = 10;
int z = l*b;
}
}
class Square extends Shape
{
public static Square()
{
int a = 11;
System.out.println(a * a);
}
}
// Java code 7, invalid method declare, return type required. (public static //CircleAttemptTwo()) // I'm lost on this one, could I have some help? // and reached end of file while parsing }, confusing to me.
/EDIT THANK YOU VERY MUCH. The constructive crit. really helped, as I ended up with a lot of knowledge and my final code was
class Shape {
public static void ShapeAttemptTwo()
{
class Circle extends Shape
{
public static CircleAttemptTwo()
{
int pi = 3.14;
int r=4;
}
}
class Rectangle extends Shape
{
public static Rectangle()
{
int l = 14;
int b = 10;
int z = l*b;
}
}
class Square extends Shape
{
public static Square()
{
int a = 11;
System.out.println(a * a);
}
}