Solved

How to implement the following code?

Posted on 2002-06-03
5
212 Views
Last Modified: 2010-03-31
I am new to JAVA And I need help with this piece of code..

I have a class-
CuLinePrinter

It has this method-
public void printText(java.lang.String s_text,
                      java.lang.String s_printer,
                      int i_num_copies)
               throws CuLinePrinterException

How do I use it inside a
Take.java class .. I want to implement it inside

the method called
public void sendEmail (sting mailto) throws EmailException{

  // how to create a new object for CuLinePrinter
  // how to initilize it and then use it..

..


}

Thanks



0
Comment
Question by:sdesar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 7052165
we'd have to see the constructor for CuLinePrinter class, but it probably has a zero argument constructor so:

public void sendEmail (sting mailto) throws EmailException{

 // how to create a new object for CuLinePrinter
 CuLinePrinter clp = new CuLinePrinter();
 clp.printText(...)

}

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7052166
i could post a better solution if you can post the code for CuLinePrinter class.
0
 

Author Comment

by:sdesar
ID: 7071143
I have another java related ques.. could u help me please?
here's the ques.

I have a String defined as -

String s_file = getfile();

I need to get the length of this s_file and if its
greater than 80 characters and split it into 2 strings and print it.

I used
int i_len = s_file.length();
and
if ( s_file != "" && i_len > 80)
{
   s_file = sfile,substring(0,80);
   String s_file2 = s_file.substring(80, i_len);

}

When I run it I get a StringIndexOut oF bounds Exception..

Any suggestions?
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 total points
ID: 7071322
s_file = sfile,substring(0,80);
String s_file2 = s_file.substring(80);

or

s_file = sfile,substring(0,80);
String s_file2 = s_file.substring(80, i_len - 80);

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7071323
if that works for you, please don't forget to close out this question and accept an answer.

Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question