The Artima Developer Community
Sponsored Link

Java Answers Forum
Thats Y I luv to play different things with java

2 replies on 1 page. Most recent reply: Dec 11, 2002 11:26 PM by Rohit

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Rohit

Posts: 38
Nickname: rohit
Registered: May, 2002

Thats Y I luv to play different things with java Posted: Dec 10, 2002 3:58 AM
Reply to this message Reply
Advertisement
Well guys,

Seems a little thing , but I have missed this in last 5 yrs,Say I have a class with a public element sat int in it,

<java>
public class First{
public int i;
}

</java>

and another class which access this public element of first class(say it prints this elemnts value in main).Perfectly legal,isnt it?

<java>
public class Second{
public static void main(String []){
System.out.println(new First().i);
}
}
</java>


Now if I change this public int of class Fiod luck.

Sonny


Rohit

Posts: 38
Nickname: rohit
Registered: May, 2002

Re: Thats Y I luv to play different things with java Posted: Dec 11, 2002 11:21 PM
Reply to this message Reply
<To_Bill>
My previous post gets mixed up with some other,dont know,whats the reason , but ,it gets corrupted twice,I m posting it again,see how it goes
</To_Bill>


Well guys,

Seems a little thing , but I have missed this in last 5 yrs,Say I have a class with a public element sat int in it,

<java>
public class First{
public int i;
}

</java>

and another class which access this public element of first class(say it prints this elemnts valu String [] stuff = { "'Twas", "brillig", "and", "the", "slithy", "toves" };
return stuff;
}

public static void main(String args[])
{
String [] gotStuff = new ArrayOfHope().getSomeStuff();
System.out.println("Here is the stuff I got:");
for( int i = 0; i < gotStuff.length; i++ )
System.out.println( i + ". " + gotStuff );
}
}[/java]2B+public+static+void+main%28String+args%5B%5D%29%0D%0A+++%7B%0D%0A++ ++++String+%5B%5D+gotStuff+%3D+new+ArrayOfHope%28%29.getSomeStuff%28%29%3B%0D%

Rohit

Posts: 38
Nickname: rohit
Registered: May, 2002

Re: Thats Y I luv to play different things with java Posted: Dec 11, 2002 11:26 PM
Reply to this message Reply
This post got screwed up again

Flat View: This topic has 2 replies on 1 page
Topic: ClassCast Exception Previous Topic   Next Topic Topic: Writting with C++

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use