hello world jruby


require 'java'
include_class 'java.util.ArrayList'
class Base
 
  @name
  @password
 
  def getname()
    return @name
  end
  def setname(name)
    @name = name
  end
  def getPassword()
    return @password
  end
  def setPassword(password)
    @password = password
  end
 
  def printTest()
    puts "ok printed on base"
    list = ArrayList.new
    for i in 0..2
       base = Base.new
       base.setname("ananth"+ i.to_s)     
       base.setPassword("password" + i.to_s)
      list.add(base)
   end
   list.each do |v|     
     puts "name #{v.getname()}"
     puts "passsword: #{v.getPassword()}"    
   end
  end
end
 
class RubyObj < Base
  def print()
    puts "ok printed"
  end
end
 
 
 
rubyobj = RubyObj.new
rubyobj.printTest()
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s