Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9102

Re: Question regarding methods and classes

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Question regarding methods and classes
Date 2011-10-22 22:12 -0700
Organization A noiseless patient Spider
Message-ID <j807nt$8h6$1@dont-email.me> (permalink)
References <4ea389df$0$13444$9a566e8b@news.aliant.net>

Show all headers | View raw


On 10/22/2011 8:28 PM, Linus Flustillbe wrote:
> Does a method have to be part of a class that gets instatiated or can it
> live in a class to be available to all other classes without
> instantiation...it's available when it's imported?

> package helperClasses;
> public class rType {

         private rType() {}

  	public static  boolean isBetweenInt(int a, int b, int c)
> 	{
> 		return (a<= c&&  a>=b);
> 	}
  	public static boolean isBetweenDouble(double target, double lower, 
double upper)
> 	{
> 		return (target<= upper&&  target>= lower);		
> 	}
> }


   import static helperClasses.rType.*;
>
> class rTypeTest {
>    public static void main(String[] args) {

       boolean hello = isBetweenInt(4,6,87);
>     System.out.println(hello);  // weird choice of variable names...
>     }
> }

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 03:28 +0000
  Re: Question regarding methods and classes Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-22 20:44 -0700
    Re: Question regarding methods and classes Patricia Shanahan <pats@acm.org> - 2011-10-23 06:14 +0100
  Re: Question regarding methods and classes markspace <-@.> - 2011-10-22 22:12 -0700
    Re: Question regarding methods and classes markspace <-@.> - 2011-10-22 22:14 -0700
      Re: Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 13:32 +0000
        Re: Question regarding methods and classes markspace <-@.> - 2011-10-23 07:43 -0700
        Re: Question regarding methods and classes Lew <lewbloch@gmail.com> - 2011-10-23 08:54 -0700
  Re: Question regarding methods and classes Roedy Green <see_website@mindprod.com.invalid> - 2011-10-23 01:37 -0700
    Re: Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 13:49 +0000
      Re: Question regarding methods and classes Roedy Green <see_website@mindprod.com.invalid> - 2011-11-02 01:23 -0700
  Re: Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 09:11 +0000

csiph-web