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 9318661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:11:09+00:00 2026-06-19T03:11:09+00:00

Today I started testing JRuby. I’m a Java a Ruby developer so I liked

  • 0

Today I started testing JRuby. I’m a Java a Ruby developer so I liked the mixture at first glance.
Then coding a little bit I found a difference and I wanna know if this is correct.
I’m using jruby 1.7.2 and ruby 1.8.7 for my testings.

In a jruby console I typed:

c = []
c.class #=> Array
c << 9 << 8 << 0 << 2
c.to_s #=> "[9, 8, 0, 2]"

Now in a ruby console I typed:

c = []
c.class #Array
c << 9 << 8 << 0 << 2
c.to_s #=> "9802"

What can be happening here and why result is not the same in both cases?

  • 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-19T03:11:10+00:00Added an answer on June 19, 2026 at 3:11 am

    The difference you are seeing is not an incompatibility between Ruby and JRuby per se. JRuby 1.7.x defaults to compatibility with Ruby 1.9.3, and so what you are actually seeing is the difference in behaviour of the Array#to_s method between Ruby 1.8.7 and Ruby 1.9.3.

    You can turn on JRuby’s 1.8-compatibility mode by passing the switch ‘–1.8’ to the jruby command or by setting the environment variable JRUBY_OPTS like this:

    export JRUBY_OPTS='--1.8'.
    

    For example, this is JRuby 1.7.2’s default 1.9-compatibility mode:

    $ JRUBY_OPTS='' irb
    > ([] << 9 << 8 << 0 << 2).to_s
    => "[9, 8, 0, 2]"
    

    And here’s the result with 1.8-compatibility turned on:

    $ JRUBY_OPTS='--1.8' irb
    > ([] << 9 << 8 << 0 << 2).to_s
    => "9802"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I started working on my first Ruby project. The goal is to convert
Today I started coding a project that uses sqlite and when I tried to
greetings, today i have started to learn java using netbeans ide. i would like
I'm (extremely) new to Ruby, having started today. I just moved from my system's
Today I started work on a small Java app. I have some experience with
Hey guys today I started to develop my own little alarmclock app. But now
Hi I just started today on creating my first Wordpress Theme and I am
Today I started learning libxml for the first time. And kept struggling to find
today I started working with DirectX(D3D9), everything went fine until I created a Static-mesh
Today i started working in registration form in magento site. As you know by

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.