Having a little trouble with this Java code. Beginner probably mixing some things with C#.
Posted
by Sergio Tapia
on Stack Overflow
See other posts from Stack Overflow
or by Sergio Tapia
Published on 2010-05-11T03:46:21Z
Indexed on
2010/05/11
3:54 UTC
Read the original article
Hit count: 535
package practico1;
/**
* Programador: Sergio Tapia Gutierrez
* Fecha: Lunes 10, Mayo - 2010
* Practico: 1
*/
public class Main {
public static void main(String[] args) {
System.out.println("Esta es una pequena aplicacion para mostrar los");
System.out.println("distintos tipos de datos que existen en Java 6.");
//boolean, char, byte, short, int, long, float, double, String
ejemplosBoolean();
}
public void ejemplosBoolean(){
}
}
So, I'm just testing some things out, but I'm getting an error claiming that I'm trying to run ejemplosBoolean() in a static context when it isn't a static method.
My question is, in Java do methods have to have static in order to use them even if they are in the same class?
© Stack Overflow or respective owner