Solved

How to implement the following code?

Posted on 2002-06-03
5
206 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
  • 4
5 Comments
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
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
Comment Utility
i could post a better solution if you can post the code for CuLinePrinter class.
0
 

Author Comment

by:sdesar
Comment Utility
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
Comment Utility
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
Comment Utility
if that works for you, please don't forget to close out this question and accept an answer.

Thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
allStar challenge 1 41
json example 39 110
word0 challenge 3 56
Checkbox and ListView in Android Layout 4 36
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now