Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8005061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:06:43+00:00 2026-06-04T17:06:43+00:00

scala> Array.fill(3){ math.random } <console>:6: error: value fill is not a member of object

  • 0
scala> Array.fill(3){ math.random }
<console>:6: error: value fill is not a member of object Array
       Array.fill(3){ math.random } 

Am I missing something here? I can’t get any of my book’s examples or even the examples write out of the scala source code to work.

Welcome to Scala version 2.7.7final (OpenJDK Server VM, Java 1.6.0_20)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:06:45+00:00Added an answer on June 4, 2026 at 5:06 pm

    Because Array doesn’t have a fill method in Scala 2.7.7… that’s pretty old. You should probably just upgrade to a more recent version. Here’s my output for the exact same code… note the version:

    Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_21).
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    scala> Array.fill(3){ math.random }
    res0: Array[Double] = Array(0.1074472419841086, 0.06627471316010758, 0.08994384621689899)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a replacement in Scala for Java's int Arrays.binarySearch(Object[] array, object) ? The
Here's a copy of the interpreter commands: scala>val myTable = Array(Array(1)) res30: Array[Array[Int]] =
How can I create an array of functions in Scala so I can loop
Please consider the following test program (using scala 2.9.0.1) object test { def main(args:Array[String])
I have a Scala array of strings: val names:Array[String] = something.map(...) I need to
Consider the following Scala code: object MainObject { def main(args: Array[String]) { import Integer.{
I used ScalaQuery and Scala. If I have an Array[Byte] object, how do I
In Scala, { x: Option[Int] => x } .getClass .getMethod(apply, classOf[Option[_]]) .getGenericParameterTypes returns Array(scala.Option<java.lang.Object>)
Does Scala have a version of Rubys' each_slice from the Array class?
is there a way in Scala to sort an array of tuples using and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.