• Post Reply Bookmark Topic Watch Topic
  • New Topic

Fill the code  RSS feed

 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fill the triangle() code
// by looking into length of three sides of triangle
// Return the type of triangle.
enum TRIANGLE_TYPE { EQUILATERAL = 1, ISOSCELES = 2, SCALENE = 3, ERROR = 4, };
TRIANGLE_TYPE triangle(int a, int b, int c)

please help.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like homework you should be doing in order to learn something. What do you have so far? If you haven't started, what ideas have you had?
 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, you are absolutely correct.

problem is I don't know how to return Enum, I can solve this by returning integer value. I searched on Google but I haven't found solution.

Thank you
Hardik
 
Hardik Patel p
Ranch Hand
Posts: 40
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer Sir,

Just give me tips how to return enum and how to handle enum, I will do my self

Thank you
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you mean by "return an enum" - an enum is a type like some other class or interface, it is returned from a method in the same way as other types. But the code fragment you posted is too short to tell what you're trying to do, and what may be going wrong.

An introduction to enums is part of the Oracle Java Tutorial (which should always be your first stop if you don't understand some Java concept) http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks incorrect syntax; can you actually get that code to compile?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!