|
import java.util.Scanner;
//import java.lang.String;
public class Main {
public static int n;
//public static String names;
//private static String[] nameS;
//private static String[] nameS;
/**
* @param args the command line arguments
*/
public static void main(String[] args/*,String[] nameS*/) {
Scanner in=new Scanner(System.in);
int Da=0;
int num []=new int[n];
//int x=0;
System.out.printf("%s\n","Enter the Number of student taking This Couse");
n=in.nextInt();
String name[]=new String [n];
System.out.printf("%s %s \n", "index","value");
for (; Da < name.length; Da++ )/*Da 4 Display array*/ {
System.out.printf( "%5d%8d\n", Da, name[Da] );
}
System.out.println("Enter the names of the student");
String names;
names=in.nextLine();
name[n] = new String(names);
for (; Da < name.length; Da++ ){
System.out.printf( "%5d%8d\n", Da, name[Da] );
}
}
}
i can not input the names into the array i created
pls help me
|
|
|
|
|
First, please put your code between <pre> and </pre> tags so it's easier to read.
Next, try stepping through your for loops. It looks to me like you need a loop to cycle n times and ask for a name[i] each time.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
pls can u do that loop for me
|
|
|
|
|
I'm going to pretend I didn't see that question.
Try it yourself and ask specific questions if you have trouble. I have my own homework to do.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Firstly, LIQUID NITROGEN.
Secondly, a for loop.
See if you can crack this: fb29a481781fe9b3fb8de57cda45fbef
The unofficial awesome history of Code Project's Bob!
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
You forgot about bacon.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
|
|
|
|
|
Bacon???
See if you can crack this: fb29a481781fe9b3fb8de57cda45fbef
The unofficial awesome history of Code Project's Bob!
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
|
hello every one
i am new to web services and i have develop web service client i netbeans using wsdl and it work will
but now i want to develop web services client without knowing the wsdl i just now the link of the web service like: aaaa.php
can i do it because i search but i did not find any results
|
|
|
|
|
|
thanks is what you attach example
can you guide me to tutorial , actually the web service is public i did not implement it
its news page and i want to read its content and search through it
modified on Wednesday, December 1, 2010 10:29 AM
|
|
|
|
|
also the page have feeds and i know the xml version o the web page but i do not know the wsdl
i hop any one can help
|
|
|
|
|
pleas i need help
|
|
|
|
|
Hi everybody
I want to develop a fuzzy expert system but I don't know what to use
Do you recommend jFuzzylogic (Eclipse plug-in) or Matlab or an expert system shell like (FuzzyCLIPS or JESS)?
I prefer the easiest and highly supported one.
Thank you in advance and sorry if this is not the suitable section
|
|
|
|
|
YMMV, but I developed my own, first in C some 15+ years ago, then updated parts of it in F#[^].
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Ive used drools before; its easy to understand and implement.
|
|
|
|
|
Hi all,
I'm having an issue with PDFBox (1.3.1) - I'm using a PDF with AcroForms to basically pull off a 'mail merge'. I am successfully populating the fields with data, but what I want to do now is 'render it down' or 'flatten' it. I don't want these fields to be editable in the final result. (not entirely sure I'm communicating my intention clearly here, let me know if clarification is needed)
I've found this post that says to "remove all fields from [the] acroform". I've tried this in a number of ways:
pdfAcroForm.getFields().clear();
and...
pdfAcroForm.setFields(new ArrayList());
and...
Iterator<PDField> fields = pdfAcroForm.getFields().iterator();
while (fields.hasNext())
{
PDField field = (PDField)fields.next();
field.setAcroForm(null);
}
and variations thereof...
while typing this I thought to try:
pdfAcroForm.setFields(new COSArrayList());
maybe that will fix it?
Anyway, does anyone know how to do this? I have this niggling feeling that it's a language barrier (I'm a native C# speaker). I also have a niggling feeling that the aforementioned article is a big red herring that's taken me down the road to the dark side...
Any help would be MUCH appreciated
|
|
|
|
|
[Caveat - I am not familiar with API you are using]
You should not need to remove the form fields. The pdf document allows itself to be locked, once locked the fields become ineditable.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
|
|
|
|
|
hi all,
I'm working on a program that suppose to read data from a text file and then creates a linked list and outputs the data sorted by last name.
But I'm getting the following errors:
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Unknown Source)
at mainStudnetProg.createStudentList(mainStudnetProg.java:36)
at mainStudnetProg.main(mainStudnetProg.java:15)
Where is the problem?!
main
import java.io.*;
import java.util.*;
public class mainStudnetProg
{
public static void main(String[] args)
{
StudentList studentList = new StudentList();
try
{
Scanner infile = new Scanner(new FileReader("C:\\studentInfo.txt"));
createStudentList(infile, studentList);
}
catch (FileNotFoundException fnfe)
{
System.out.println(fnfe.toString());
}
}
public static void createStudentList(Scanner infile, StudentList studentList)
{
String fName;
String lName;
int id;
Student newStudent;
while (infile.hasNext())
{
fName = infile.nextLine();
lName = infile.nextLine();
id = infile.nextInt();
infile.nextLine();
newStudent = new Student();
newStudent.setStudentInfo(fName, lName, id);
studentList.insertFirst(newStudent);
}
}
}
modified on Friday, November 26, 2010 10:59 PM
|
|
|
|
|
Without copying the code into eclipse:
No line found
at java.util.Scanner.nextLine
public static void createStudentList(Scanner infile, StudentList studentList)
{
String fName;
String lName;
int id;
Student newStudent;
while (infile.hasNext())
{
fName = infile.nextLine();
lName = infile.nextLine();
id = infile.nextInt();
infile.nextLine();
newStudent = new Student();
newStudent.setStudentInfo(fName, lName, id);
studentList.insertFirst(newStudent);
}
}
This method is the only position where "nextLine" is used.
The 3. "nexLine" seems strange to me - you do not handle any replies there. So why do you read the next line?
regards
Torsten
I never finish anyth...
|
|
|
|
|
while (infile.hasNext())
{
fName = infile.nextLine();
lName = infile.nextLine();
id = infile.nextInt();
infile.nextLine();
...
}
Your call to hasNext() only returns true if there is a line ready to be read, it does not guarantee that there will be three lines waitng, so your code may well fail as you see.
BTW Please do not post your complete project in future, but just the lines relevant to the problem.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
just the lines relevant to the problem.
... if only he knew which lines are relevant...
regards
Torsten
I never finish anyth...
|
|
|
|
|
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I wasn't sure which lines were relevant but I knew I had a problem reading the file in main.
|
|
|
|
|
Babylon Lion wrote: Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Unknown Source)
at mainStudnetProg.createStudentList(mainStudnetProg.java:36)
at mainStudnetProg.main(mainStudnetProg.java:15)
Why don't you take advantage of the information provided? a traceback shows exactly where the program is when the problem occurs. It is inside nextLine (not yours, so less relevant), called by createStudentList (yours) and to be more precise: in file mainStudnetProg.java at line 36.
BTW: tell your IDE to always show line numbers in source file windows, and you're bound to see the problem pretty soon.
|
|
|
|