You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Apurv Verma <da...@gmail.com> on 2011/12/20 23:45:26 UTC

Why is the constructor for Fraction class private.

Hii all,
   I recently began exploring apache commons library. I downloaded the
latest copy from [0]. Here is the code that I wanted to run.


import org.apache.commons.lang3.math.Fraction;

public class FractionDemo {

public static void main(String[] args) {
 Fraction f = new Fraction(1,3);

}

}

I can't do this because the constructor in the Fraction class has been made
private. I was following the tutorials given here [1]



[0]
http://www.ecoficial.com/am/commons/lang/binaries/commons-lang3-3.1-bin.tar.gz
[1] http://commons.apache.org/math/userguide/fraction.html


--
thanks and regards,

Apurv

Re: Why is the constructor for Fraction class private.

Posted by Chris Pratt <th...@gmail.com>.
http://commons.apache.org/math/download_math.cgi
  (*Chris*)

On Tue, Dec 20, 2011 at 3:06 PM, Apurv Verma <da...@gmail.com> wrote:

>   1. Where can I download the version that uses
>   org.apache.commons.math.Fraction (no lang3)
>   Is this/Is this not the recommended package to use?
>
>
> --
> thanks and regards,
>
> Apurv
>
>
>
>
>
> On Wed, Dec 21, 2011 at 4:24 AM, William Speirs <ws...@apache.org>
> wrote:
>
> > If you are using the Fraction class in lang3, use the getFraction method:
> >
> >
> http://commons.apache.org/lang/api-3.1/org/apache/commons/lang3/math/Fraction.html#getFraction(int,%20int)
> >
> > Bill-
> > On Dec 20, 2011 5:51 PM, "Chris Pratt" <th...@gmail.com> wrote:
> >
> > > Hmmm, the javadoc on the page you referenced shows the package as
> > > org.apache.commons.math.Fraction, no lang3 in there.  And it also shows
> > the
> > > Constructors as public.
> > >  (*Chris*)
> > >
> > > On Tue, Dec 20, 2011 at 2:45 PM, Apurv Verma <da...@gmail.com>
> wrote:
> > >
> > > > Hii all,
> > > >   I recently began exploring apache commons library. I downloaded the
> > > > latest copy from [0]. Here is the code that I wanted to run.
> > > >
> > > >
> > > > import org.apache.commons.lang3.math.Fraction;
> > > >
> > > > public class FractionDemo {
> > > >
> > > > public static void main(String[] args) {
> > > >  Fraction f = new Fraction(1,3);
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > > I can't do this because the constructor in the Fraction class has
> been
> > > made
> > > > private. I was following the tutorials given here [1]
> > > >
> > > >
> > > >
> > > > [0]
> > > >
> > > >
> > >
> >
> http://www.ecoficial.com/am/commons/lang/binaries/commons-lang3-3.1-bin.tar.gz
> > > > [1] http://commons.apache.org/math/userguide/fraction.html
> > > >
> > > >
> > > > --
> > > > thanks and regards,
> > > >
> > > > Apurv
> > > >
> > >
> >
>

Re: Why is the constructor for Fraction class private.

Posted by Apurv Verma <da...@gmail.com>.
   1. Where can I download the version that uses
   org.apache.commons.math.Fraction (no lang3)
   Is this/Is this not the recommended package to use?


--
thanks and regards,

Apurv





On Wed, Dec 21, 2011 at 4:24 AM, William Speirs <ws...@apache.org> wrote:

> If you are using the Fraction class in lang3, use the getFraction method:
>
> http://commons.apache.org/lang/api-3.1/org/apache/commons/lang3/math/Fraction.html#getFraction(int,%20int)
>
> Bill-
> On Dec 20, 2011 5:51 PM, "Chris Pratt" <th...@gmail.com> wrote:
>
> > Hmmm, the javadoc on the page you referenced shows the package as
> > org.apache.commons.math.Fraction, no lang3 in there.  And it also shows
> the
> > Constructors as public.
> >  (*Chris*)
> >
> > On Tue, Dec 20, 2011 at 2:45 PM, Apurv Verma <da...@gmail.com> wrote:
> >
> > > Hii all,
> > >   I recently began exploring apache commons library. I downloaded the
> > > latest copy from [0]. Here is the code that I wanted to run.
> > >
> > >
> > > import org.apache.commons.lang3.math.Fraction;
> > >
> > > public class FractionDemo {
> > >
> > > public static void main(String[] args) {
> > >  Fraction f = new Fraction(1,3);
> > >
> > > }
> > >
> > > }
> > >
> > > I can't do this because the constructor in the Fraction class has been
> > made
> > > private. I was following the tutorials given here [1]
> > >
> > >
> > >
> > > [0]
> > >
> > >
> >
> http://www.ecoficial.com/am/commons/lang/binaries/commons-lang3-3.1-bin.tar.gz
> > > [1] http://commons.apache.org/math/userguide/fraction.html
> > >
> > >
> > > --
> > > thanks and regards,
> > >
> > > Apurv
> > >
> >
>

Re: Why is the constructor for Fraction class private.

Posted by William Speirs <ws...@apache.org>.
If you are using the Fraction class in lang3, use the getFraction method:
http://commons.apache.org/lang/api-3.1/org/apache/commons/lang3/math/Fraction.html#getFraction(int,%20int)

Bill-
On Dec 20, 2011 5:51 PM, "Chris Pratt" <th...@gmail.com> wrote:

> Hmmm, the javadoc on the page you referenced shows the package as
> org.apache.commons.math.Fraction, no lang3 in there.  And it also shows the
> Constructors as public.
>  (*Chris*)
>
> On Tue, Dec 20, 2011 at 2:45 PM, Apurv Verma <da...@gmail.com> wrote:
>
> > Hii all,
> >   I recently began exploring apache commons library. I downloaded the
> > latest copy from [0]. Here is the code that I wanted to run.
> >
> >
> > import org.apache.commons.lang3.math.Fraction;
> >
> > public class FractionDemo {
> >
> > public static void main(String[] args) {
> >  Fraction f = new Fraction(1,3);
> >
> > }
> >
> > }
> >
> > I can't do this because the constructor in the Fraction class has been
> made
> > private. I was following the tutorials given here [1]
> >
> >
> >
> > [0]
> >
> >
> http://www.ecoficial.com/am/commons/lang/binaries/commons-lang3-3.1-bin.tar.gz
> > [1] http://commons.apache.org/math/userguide/fraction.html
> >
> >
> > --
> > thanks and regards,
> >
> > Apurv
> >
>

Re: Why is the constructor for Fraction class private.

Posted by Chris Pratt <th...@gmail.com>.
Hmmm, the javadoc on the page you referenced shows the package as
org.apache.commons.math.Fraction, no lang3 in there.  And it also shows the
Constructors as public.
  (*Chris*)

On Tue, Dec 20, 2011 at 2:45 PM, Apurv Verma <da...@gmail.com> wrote:

> Hii all,
>   I recently began exploring apache commons library. I downloaded the
> latest copy from [0]. Here is the code that I wanted to run.
>
>
> import org.apache.commons.lang3.math.Fraction;
>
> public class FractionDemo {
>
> public static void main(String[] args) {
>  Fraction f = new Fraction(1,3);
>
> }
>
> }
>
> I can't do this because the constructor in the Fraction class has been made
> private. I was following the tutorials given here [1]
>
>
>
> [0]
>
> http://www.ecoficial.com/am/commons/lang/binaries/commons-lang3-3.1-bin.tar.gz
> [1] http://commons.apache.org/math/userguide/fraction.html
>
>
> --
> thanks and regards,
>
> Apurv
>