Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exam question

 
soni madhuri
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class Stone{

public void myMethod(){
System.out.println("hgdsf");
}


}
public class BigStone{

public static void main(String args[])
{
BigStone[] b = new BigStone( new Stone(), new Stone(), new Stone());
}
}

Can we declare Stone objects like they are in the code.

please need an answer.

madhuri.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by declaring objects in your code. Certainly, you can create new objects in your code, so you code appears completely valid.

-Cameron McKenzie
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic