473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

java declaration not clear

I got a declaration like this.

Object obj=constructor.newInstance(new Object[] {"abc"});
//constructor is a object of Constructor class(using reflection)

i am not clear with the declarartion like this.can some1 explain what is in the brace{"abc"}, as well as the complete declaration in detail.
thanx in advance.
Feb 20 '12 #1
1 1301
r035198x
13,262 8TB
It's just a short cut of
Expand|Select|Wrap|Line Numbers
  1. Object[] objectArray = new Object[] {"abc"};
  2. Object obj=constructor.newInstance(objectArray);
  3.  
Now,
Expand|Select|Wrap|Line Numbers
  1. Object[] objectArray = new Object[] {"abc"};
  2.  
Is itself a shortcut of creating a new array and populating it at the same time.
e.g if I wanted an array with the integers 0, 3, 5, 1, 9 I could do it as follows
Expand|Select|Wrap|Line Numbers
  1.         int[] rzero = new int[5];
  2.         rzero[0] = 0;
  3.         rzero[1] = 3;
  4.         rzero[2] = 5;
  5.         rzero[3] = 1;
  6.         rzero[4] = 9;
  7.         rzero[5] = 8;
  8.  
Or the shortcut

Expand|Select|Wrap|Line Numbers
  1.  int[] rzero = new int[]{0,3,5,1,9,8};
Feb 20 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
3
by: Sai Kit Tong | last post by:
Hi, I am developing a new application running on Windows platform that needs to interface with existing legacy code - written in basic C / C++. I am trying to evaluate Java vs C#...
3
by: Sai Kit Tong | last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't make it clear in my original mail. I got a couple of answers but none of them address my issues directly (See attached...
3
by: Richard A. Lowe | last post by:
Hi all (sorry I haven't been around lately for those who know me, life happens :) I have to call a native DLL (written > 5 years ago, not by me, and all source lost) that is currently being...
458
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers...
4
by: shapper | last post by:
Hello, Consider the following design: <div id="container"> <div id="A" class="A"></div> <div id="B" class="B"></div> </div> And the CSS classes:
7
helpwithcode
by: helpwithcode | last post by:
Hi people, I am just learning java.I have been creating a project which involves JDBC Connectivity.I find that the statements, String string_dob=text_dob.getText(); //Converting string to...
49
by: aarklon | last post by:
Hi all, See:- http://www.cs.princeton.edu/introcs/faq/c2java.html for C vs Java in number crunching http://husnusensoy.blogspot.com/2006/06/c-vs-java-in-number-crunching.html
0
by: Anu Joseph | last post by:
hi....am new to these kinda forums n am glad that am posting one question on the day of my join. I am really interested in programming n i have a basic knowledge of c,c++ and data structures.. ...
1
by: danielmessick | last post by:
Hello, I'm trying to fix my Java applet to have a fully functional calculator. I managed to create the buttons and have the +, -, /, *, =, and clear buttons WORKING. But, I cant seem to figure out...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.