You cannot define methods in constructors but you can call them. Your problem here is that you do not construct an object of the type "temp", the constructor only gets called when you say new temp(); which you can do in you main method.
To be honest I think this will be my last response to you. I have better things to do with my time than give private Java tutorials. There are THOUSANDS of java tutorials on the web and as I advised in post #2 above, go and work through some of them.
To be honest I think this will be my last response to you. I have better things to do with my time than give private Java tutorials. There are THOUSANDS of java tutorials on the web and as I advised in post #2 above, go and work through some of them.