EXHIBIT 5 --------- [LETTERHEAD OF HALE AND DORR LLP APPEARS HERE] February 13, 1998 Keane, Inc. Ten City Square Boston, MA 02129 Ladies and Gentlemen: We have assisted in the preparation of the Registration Statement on Form S-3 (the "Registration Statement") filed with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Securities Act"), relating to the registration for resale by the Selling Shareholders named therein of 189,828 shares of common stock, $0.10 par value per share (the "Shares"), of Keane, Inc., a Massachusetts corporation (the "Company"). We have examined the Articles of Organization and the By-Laws of the Company and all amendments thereto and the Agreement and Plan of Merger dated January 12, 1998 by and among the Company, Alpha Acquisition Corp. and Quantum Associates d/b/a Omega Systems (the "Merger Agreement"), and have examined and relied on the originals, or copies certified to our satisfaction, of such records of meetings, written actions in lieu of meetings, or resolutions adopted at meetings, of the directors and stockholders of the Company, all as provided to us by the Company, and such other documents and instruments as in our judgment are necessary or appropriate to enable us to render the opinions expressed below. In our examination of the foregoing documents, we have assumed (i) the genuineness of all signatures and the authenticity of all documents submitted to us as originals, (ii) the conformity to the originals of all documents submitted to us as certified, photostatic or facsimile copies, (iii) the authenticity of the originals of the latter document, and (iv) the legal competence of all signatures to such documents. We express no opinion herein as to the laws of any stock or jurisdiction other than the state laws of the Commonwealth of Massachusetts and the federal laws of the United States of America. Based upon and subject to the foregoing, we are of the opinion that the Shares have been duly authorized and, when issued in accordance with the provisions of the Merger Agreement, will be validly issued, fully paid and non- assessable. It is our understanding that this opinion is to be used only in connection with the offer and sale of the Shares while the Registration Statement is in effect. We hereby consent to the filing of this opinion with the Commission as an exhibit to the Registration Statement in accordance with the requirements of Item 601(b)(5) of Regulation S-K under the Securities Act and to the use of our name therein and in the related Prospectus under the caption "Legal Matters." In giving such consent, we do not hereby admit that we are in the category of persons whose consent is required under Section 7 of the Securities Act or the rules and regulations of the Commission. Very truly yours, /s/ Hale and Dorr LLP HALE AND DORR LLP