|
i need to get cell with this value "123k2"
i was tried that code
s.getRow(0).getCell(0).getRichStringCellValue().toString()
but i get this messege "
Cannot get a NUMERIC value from a STRING cell "
how i can get it
|
|
|
|
|
You should not need to call toString on a string item. Other than that the error message does not appear to match the code. Where is the actual code that is trying to get a numeric value?
|
|
|
|
|
ok is done.
so now i need to put this value in a arraylist i tried this code but it is incorrect i need to know where is the fault or have other method to put the cells in arraylist
t[0].add(s.getRow(0).getCell(0).getRichStringCellValue().toString();
System.out.println("ob "+t[0]);
|
|
|
|
|
With that code, the compiler will tell you where the fault is. (Missing closing parenthesis on the first line.)
If you get a compiler error or a runtime error that you don't understand, and you want us to help you, then you need to include the error details. Just saying "it is incorrect" or "it doesn't work" is not enough.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
iheb11 wrote: i tried this code but it is incorrect How is it incorrect? Please do not leave us to guess.
|
|
|
|
|
the error is :<pre>" Uncompilable source code - Incorrect symbol type: <any> .add"
The error is more complicated than a non-closed parenthesis on the first line
And we are all here to interact with each other and learn from each other even their mistake, tnx for your help and for your good advice
|
|
|
|
|
i need to get data from a file excel in java and to display the data on a jTable please help me to resolve this problem tnx
i was try this code but i think is incorrect
<
public Object getCellValue(Sheet sheet, int rowNum, int colNum) {
Row row = sheet.getRow(rowNum);
if ( row==null ) {
return null;
}
else {
Cell cell = row.getCell(colNum);
if ( cell==null ) {
return null;
}
else {
return getCellValue(cell);
}
}
}
public Object getCellValue(Cell cell) {
switch (cell.getCellTypeEnum()) {
case CellType.STRING:
return cell.getRichStringCellValue().getString();
case CellType.NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
return cell.getDateCellValue();
} else {
return cell.getNumericCellValue();
}
case CellType.BOOLEAN:
return cell.getBooleanCellValue();
case CellType.FORMULA:
return evalCell(cell);
case CellType.BLANK:
return null;
default:
throw new IllegalStateException("Unknown cell type");
}
private Object evalCell(Cell cell) {
FormulaEvaluator evaluator = cell.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
CellValue cellValue = evaluator.evaluate(cell);
switch (cellValue.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN:
return cellValue.getBooleanValue();
case Cell.CELL_TYPE_NUMERIC:
return cellValue.getNumberValue();
case Cell.CELL_TYPE_STRING:
return cellValue.getStringValue();
case Cell.CELL_TYPE_BLANK:
return null;
case Cell.CELL_TYPE_ERROR:
throw new RuntimeException("Excel formula error");
default:
throw new IllegalStateException("Unknown cell type");
}
}
|
|
|
|
|
iheb11 wrote: i was try this code but i think is incorrect Then please explain why. We can only help if you explain what the problem is.
|
|
|
|
|
|
Can Write a java program to develop object oriented software covering requirements mentioned below.
Requirements of the Software Application
* Select title for the software application and it should be meaningful
* Application should use number of classes between 3-5 in additional to main method class.
CAN ANYONE WRITE A SIMPLE PROGRAM USING Encapsulation, inheritance, polymorphism and abstraction please.
ITS SO THAT I CAN UNDERSTAND BETTER
(SORRY FOR MY BAD ENGLSIH)
ALSO I NEED THIS IN CONSOLE JAVA (u know to run with cmd)
What I have tried:
I Tried writing JAVA in notepad but i couldnt understand how to write a simple program combining Encapsulation, inheritance, polymorphism and abstraction
|
|
|
|
|
We're not here to do your homework for you.
We weren't here to do your homework for you when you posted this in QA[^]. Reposting the same demand for code in another forum isn't going to change that.
If you don't know how to do your homework, then talk to your teacher. That's what they're there for.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
How can i register with new nimbuzz account using java with smack library.I tried old method but its not working now. its giveing an error "not-allowed (error 405) you are using old version of nimbuzz please upgrade.For more information visit on http://wap.nimbuzz.com".
Please Help.
|
|
|
|
|
Read the error message, it is pretty explicit:
Member 12954153 wrote: "not-allowed (error 405) you are using old version of nimbuzz please upgrade.For more information visit on http://wap.nimbuzz.com"
So visit the website it gives, and see what information it provides.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
the web address "http://wap.nimbuzz.com" is not available now.
|
|
|
|
|
|
Anyone can suggest any website where I can learn from starting about Java ?
|
|
|
|
|
The official The Java™ Tutorials[^]
Peter Leow
http://www.peterleowblog.com/
https://www.amazon.com/author/peterleow
|
|
|
|
|
Message Closed
modified 30-Jan-17 13:00pm.
|
|
|
|
|
You need to click on the link in the main part of his reply, which will lead you to the Java Tutorials. Or you could just use Google to do your own research.
|
|
|
|
|
happyvalentinesdaywishess.com wrote: suggest any website
www.codeproject.com is a pretty decent website for learning programming.
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
Your username makes you look like a spammer. Please change it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I created program where when user checks checkbox edit text is enabled, but when I check any of checkboxes nothing happens!!!
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText2 = (EditText) findViewById(R.id.editText_symbols);
editText3 = (EditText) findViewById(R.id.editText_numbers);
editText4 = (EditText) findViewById(R.id.editText_lowercase);
editText5 = (EditText) findViewById(R.id.editText_uppercase);
editText2.setEnabled(false);
editText3.setEnabled(false);
editText4.setEnabled(false);
editText5.setEnabled(false);
}
public void checkCheckBox(View view)
{
boolean checked = (((CheckBox)view).isChecked());
switch (view.getId())
{
case R.id.checkBox_uppercase:
if(checked)
editText2.setEnabled(true);
else
editText2.setEnabled(false);
break;
case R.id.checkBox_lowercase:
if(checked)
editText3.setEnabled(true);
else
editText3.setEnabled(false);
break;
case R.id.checkBox_numbers:
if(checked)
editText4.setEnabled(true);
else
editText4.setEnabled(false);
break;
case R.id.checkBox_symbols:
if(checked)
editText5.setEnabled(true);
else
editText5.setEnabled(false);
break;
}
}
modified 10-Jan-17 5:53am.
|
|
|
|
|
|
Try this
((CheckBox)view).setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
switch (view.getId())
{
case R.id.checkBox_uppercase:
if(checked)
editText2.setEnabled(true);
else
editText2.setEnabled(false);
break;
case R.id.checkBox_lowercase:
if(checked)
editText3.setEnabled(true);
else
editText3.setEnabled(false);
break;
case R.id.checkBox_numbers:
if(checked)
editText4.setEnabled(true);
else
editText4.setEnabled(false);
break;
case R.id.checkBox_symbols:
if(checked)
editText5.setEnabled(true);
else
editText5.setEnabled(false);
break;
}
}
});
Late but hope this helps!
|
|
|
|