多数据类型

时间:2015-11-26 19:11:39

标签: arrays object

我正在搜索“对象阵列”& “具有多种数据类型的数组”,我没有找到任何有用的页面。所以这是一个示例代码,您可以通过注释完成它。我很欣赏你需要做的事情。

public class Student 
{
  String[] name = new String[];
  int[] grade = new int[];
} 

1 个答案:

答案 0 :(得分:0)

我不知道你的问题是什么,但是一系列对象很容易 - 真的,只是谷歌。

学生班

Exiting
/Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:555:in `add_route': Invalid route name, already in use: 'root'  (ArgumentError)
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here: 
http://guides.rubyonrails.org/routing.html#restricting-the-routes-created
    from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:1561:in `add_route'
    from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:1536:in `decomposed_match'
    from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:1517:in `block in match'
    from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:1507:in `each'
    from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:1507:in `match'
    from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:387:in `root'
    from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:1580:in `root'
    from /Users/khataev/Documents/development/rails/vkontakte_on_rails/config/routes.rb:9:in `block in <top (required)>'
....

使用数组

public class Student
{
   public String name;
   public int grade;
}