Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-11-2009
Member
 
Join Date: Jan 2009
Posts: 30
Unknown Features of Java

Hi ,

I know about most of features of JAVA language.
But I am thinking regarding less used features of the JAVA language is a fun refresher.

Do you think of any more "Unknown" features of this language? Or just anything interesting that not most of language user are familiar with?

If you know some hidden properties or features of JAVA language ,Please share with us.
Reply With Quote
  #2  
Old 14-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Unknown Features of Java

Hello,

I don't think anybody is familiar with this feature of JAVA language. See below code:

public static void main(String[] args) {
System.out.print("iexplore:");
http://www.google.com;
System.out.println(":maximize");
}
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 14-11-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: Unknown Features of Java

I got surprised about return type generics feature of java.

As I often use Java to write tests and need to select as well as generate testdata,

the below code help to randomizing selection of data :


public static <T> T selectRandom(List<T> list) {
if (list != null) {
int listSize = list.size();

return listSize > 0 ? list.get(RANDOM_NUMBER_GENERATOR.nextInt(listSize)) : null;
}

return null;
}

public static <T> T selectRandom(T... array) {
if (array != null) {
return array.length > 0 ? array[RANDOM_NUMBER_GENERATOR.nextInt(array.length)] : null;
}

return null;
}




I hope this will also help you also
Reply With Quote
  #4  
Old 14-11-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Unknown Features of Java

I am aware about a way to avoid some of the tedious as well as difficult casts with generics return from other generic methods

public <x> x foo() {
//blah
return a;
}

public <y> y bar() {
return <y>foo();
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Unknown Features of Java"
Thread Thread Starter Forum Replies Last Post
Java Auto Updater wants me to update java everyday in Windows 7 minajoh Windows Software 4 04-09-2013 11:04 PM
Error "java.util.Arrays.mergeSort (Unknown Source)" Fragant Software Development 7 09-09-2010 10:18 PM
Java/Selace.K trojan causing unknown downloads to occur Jaimenacho Networking & Security 5 12-01-2010 04:25 PM
Link List Example in Java Sample program in Java trickson Software Development 2 04-08-2009 08:23 PM


All times are GMT +5.5. The time now is 02:32 PM.