Hey,
public ConditionalOperator() {
}
is a default constructor(with out any parameters). it will call when you are
creating an object with repective ConditionalOperator class name.
we can intiate instance variables (declared inside of class with out static
keyword) by giving default values into this constructors like :
public ConditionalOperator(){
this.name = "myname";
this.id="1234";
}
these values are taken as default while creating object.
you can set values by calling variables with reference of object:
ConditionalOperator cop = new ConditionalOperator();
cop.name= "sindhu" ;
cop.id = "213";
You can get more info on constructors in this below URL:
http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html
Please let me know if you have any questions........
Thanks
srini
--- On Mon, 13/7/09, sindura pulimamidi <[email protected]>
wrote:
From: sindura pulimamidi <[email protected]>
Subject: [java programming] pls clarify this lab:1002
To: [email protected]
Date: Monday, 13 July, 2009, 3:02 PM
Hi everyone,
the below program can executes with out the statements written in red color
what is the use of the method in this program....pls tell me
public class ConditionalOperator {
/** Creates a new instance of ConditionalOperator */
public ConditionalOperator() {
}
public static void main(String[] args) {
String status = "";
int grade = 80;
status = (grade >= 60)?"Passed":"Fail";
System.out.println( status );
}
}
See the Web's breaking stories, chosen by people like you. Check out
Yahoo! Buzz. http://in.buzz.yahoo.com/
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---