{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,4,28]],"date-time":"2026-04-28T15:36:02Z","timestamp":1777390562373,"version":"3.51.4"},"reference-count":35,"publisher":"World Scientific Pub Co Pte Ltd","issue":"06","funder":[{"name":"Vietnam National University Ho Chi Minh City","award":["DS.C2025-20-22"],"award-info":[{"award-number":["DS.C2025-20-22"]}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Int. J. Soft. Eng. Knowl. Eng."],"published-print":{"date-parts":[[2026,5]]},"abstract":"<jats:p>Automated code generation using large language models (LLMs) has attracted significant attention due to its potential to enhance software development. However, ensuring both accuracy and efficiency in generated code remains challenging. Prior research has mainly advanced along two directions: (i) enhancing models through architectural improvements, larger parameter scaling, and domain-specific fine-tuning; and (ii) refining prompt engineering techniques to better structure inputs and guide outputs. In this work, we pursue the latter direction and introduce a prompt engineering-based approach for Java code generation. Rather than directly generating Java code from natural language specifications, we propose a two-step pipeline: (i) generating intermediate Python code and, (ii) translating Python into Java. This design leverages the strong performance of LLMs on Python while enabling systematic optimization of the translation stage. To achieve this, we propose a set of translation strategies combining prompt engineering principles\u00a0\u2014 including explicit instructions, syntax guidance, and domain keyword constraints\u00a0\u2014 with advanced reasoning strategies such as Zero-shot Chain of Thought (Zero-shot-CoT) to efficiently generate Java code. Experiments on the HumanEval-X benchmark using the CodeGeeX3 model show that the proposed strategies significantly improve the accuracy of Java code generation. We further evaluate across diverse programming tasks, including file operations, HTTP APIs, database connectivity, parallel computing, and graphical applications, confirming the robustness of our approach. Finally, we validate the generality of our findings using ChatGPT (GPT-4o), observing substantial improvements over baseline prompt designs.<\/jats:p>","DOI":"10.1142\/s0218194025500974","type":"journal-article","created":{"date-parts":[[2025,11,28]],"date-time":"2025-11-28T10:02:09Z","timestamp":1764324129000},"page":"873-900","source":"Crossref","is-referenced-by-count":1,"title":["Java Code Generation Using Prompt Engineering Techniques"],"prefix":"10.1142","volume":"36","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-7316-2807","authenticated-orcid":false,"given":"A.","family":"Truong","sequence":"first","affiliation":[{"name":"Ho Chi Minh City University of Technology (HCMUT), 268 Ly Thuong Kiet Street, Dien Hong Ward, Ho Chi Minh City, Vietnam"},{"name":"Vietnam National University, Ho Chi Minh City (VNU-HCM), Vietnam"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0009-0000-0380-9030","authenticated-orcid":false,"given":"Phuong","family":"Le","sequence":"additional","affiliation":[{"name":"Ho Chi Minh City University of Technology (HCMUT), 268 Ly Thuong Kiet Street, Dien Hong Ward, Ho Chi Minh City, Vietnam"},{"name":"Vietnam National University, Ho Chi Minh City (VNU-HCM), Vietnam"}],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0009-0005-8127-6328","authenticated-orcid":false,"given":"Hau","family":"Tran","sequence":"additional","affiliation":[{"name":"Ho Chi Minh City University of Technology (HCMUT), 268 Ly Thuong Kiet Street, Dien Hong Ward, Ho Chi Minh City, Vietnam"},{"name":"Vietnam National University, Ho Chi Minh City (VNU-HCM), Vietnam"}],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"219","published-online":{"date-parts":[[2026,1,5]]},"reference":[{"key":"S0218194025500974BIB001","volume-title":"Dive Into Deep Learning","author":"Zhang A.","year":"2023"},{"key":"S0218194025500974BIB002","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/P16-1057"},{"key":"S0218194025500974BIB003","first-page":"6000","volume-title":"Proc. 31st Int. Conf. Neural Information Processing Systems","author":"Vaswani A.","year":"2017"},{"key":"S0218194025500974BIB004","unstructured":"T. S. Alec Radford, Karthik Narasimhan and I. Sutskever, Improving language understanding by generative pre-training, https:\/\/arxiv.org\/abs\/2012.11747."},{"key":"S0218194025500974BIB005","unstructured":"B. Roziere, J. Gehring, F. Gloeckle, S. Sootla, I. Gat, X. E. Tan, Y. Adi, J. Liu, R. Sauvestre and T. Remez, Code Llama: Open foundation models for code, https:\/\/arxiv.org\/abs\/2308.12950."},{"key":"S0218194025500974BIB006","unstructured":"H. Naveed, A. U. Khan, S. Qiu, M. Saqib, S. Anwar and M. Usman, A comprehensive overview of large language models, https:\/\/arxiv.org\/abs\/2307.06435."},{"key":"S0218194025500974BIB007","first-page":"1877","volume-title":"Advances in Neural Information Processing Systems","volume":"33","author":"Brown T.","year":"2020"},{"issue":"2","key":"S0218194025500974BIB008","first-page":"1","volume":"34","author":"Li J.","year":"2025","journal-title":"ACM Trans. Soft. Eng. Methodol."},{"key":"S0218194025500974BIB009","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/2022.deelio-1.10"},{"key":"S0218194025500974BIB010","doi-asserted-by":"publisher","DOI":"10.1145\/3597503.3608134"},{"key":"S0218194025500974BIB011","unstructured":"S. Carta, A. Giuliani, L. Piano, A. S. Podda, L. Pompianu and S. G. Tiddia, Iterative zero-shot LLM prompting for knowledge graph construction, https:\/\/arxiv.org\/abs\/2307.01128."},{"key":"S0218194025500974BIB012","series-title":"Proceedings of Machine Learning Research","first-page":"8678","volume-title":"Int. Conf. Machine Learning","author":"He Y.","year":"2022"},{"key":"S0218194025500974BIB013","first-page":"24824","volume-title":"Advances in Neural Information Processing Systems","volume":"35","author":"Wei J.","year":"2022"},{"key":"S0218194025500974BIB014","unstructured":"A. S. Z. X. Wo, (Zhipu AI open day) CodeGeeX3 technology sharing, 2024, https:\/\/www.bilibili.com\/video\/BV1YK411Y74U."},{"key":"S0218194025500974BIB015","unstructured":"Z. Z. S. Daima, Code review, inlinechat, and RAG capabilities are all provided exclusively. this wave of new CodeGeeX is a solid replacement for github copilot!, 2024, https:\/\/www.cnblogs.com\/chattech\/p\/17972237."},{"key":"S0218194025500974BIB016","unstructured":"OpenWrite, New features such as automatic generation of unit tests, plug-in open source code base, and codegeex plugin for jetbrains ides are now available!, 2024, https:\/\/www.cnblogs.com\/chattech\/p\/18071249."},{"key":"S0218194025500974BIB017","unstructured":"R. A. Poldrack, T. Lu and G. Begus, AI-assisted coding: Experiments with GPT-4, https:\/\/arxiv.org\/abs\/2304.13187."},{"key":"S0218194025500974BIB018","doi-asserted-by":"publisher","DOI":"10.1145\/3580305.3599790"},{"key":"S0218194025500974BIB019","doi-asserted-by":"publisher","DOI":"10.1145\/3653304"},{"key":"S0218194025500974BIB020","unstructured":"R. Anil, A. M. Dai, O. Firat, M. Johnson, D. Lepikhin, A. Passos, S. Shakeri, E. Taropa, P. Bailey, Z. Chen\n                      et al.\n                      , Palm 2 Technical Report, https:\/\/arxiv.org\/abs\/2305.10403."},{"key":"S0218194025500974BIB021","unstructured":"E. Nijkamp, H. Hayashi, C. Xiong, S. Savarese and Y. Zhou, CodeGen2: Lessons for training llms on programming and natural languages, https:\/\/arxiv.org\/abs\/2305.02309."},{"key":"S0218194025500974BIB022","unstructured":"R. Li, L. B. Allal, Y. Zi, N. Muennighoff, D. Kocetkov, C. Mou, M. Marone, C. Akiki, J. Li, J. Chim\n                      et al.\n                      , Starcoder: May the source be with you!, https:\/\/arxiv.org\/abs\/2305.06161."},{"key":"S0218194025500974BIB023","unstructured":"Y. Wang, H. Le, A. D. Gotmare, N. D. Bui, J. Li and S. C. Hoi, CodeT5+: Open code large language models for code understanding and generation, https:\/\/arxiv.org\/abs\/2305.07922."},{"key":"S0218194025500974BIB024","unstructured":"H. Touvron, L. Martin, K. Stone, P. Albert, A. Almahairi, Y. Babaei, N. Bashlykov, S. Batra, P. Bhargava, S. Bhosale\n                      et al.\n                      , Llama 2: Open foundation and fine-tuned chat models, https:\/\/arxiv.org\/abs\/2307.09288."},{"key":"S0218194025500974BIB025","unstructured":"M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. D. O. Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman\n                      et al.\n                      , Evaluating large language models trained on code, https:\/\/arxiv.org\/abs\/2107.03374."},{"key":"S0218194025500974BIB026","unstructured":"A. Buscemi, Comparative study of code generation using chatGPT 3.5 across 10 programming languages, https:\/\/arxiv.org\/abs\/2308.04477."},{"key":"S0218194025500974BIB027","unstructured":"A. Liu, B. Feng, B. Xue, B. Wang, B. Wu, C. Lu\n                      et al.\n                      , DeepSeek-V3 Technical Report, https:\/\/arxiv.org\/abs\/2412.19437."},{"key":"S0218194025500974BIB028","unstructured":"M. Bullwinkle, P. Farley and E. Urban, Prompt engineering techniques, 2024, https:\/\/learn.microsoft.com\/en-us\/azure\/ai-services\/openai\/concepts\/prompt-engineering?tabs=completion."},{"key":"S0218194025500974BIB029","unstructured":"OpenAI, Prompt engineering \u2014 openAI API, 2024, https:\/\/platform.openai.com\/docs\/guides\/prompt-engineering."},{"key":"S0218194025500974BIB030","first-page":"22199","volume-title":"Advances in Neural Information Processing Systems","volume":"35","author":"Kojima T.","year":"2022"},{"key":"S0218194025500974BIB031","unstructured":"C. Zeng, S. Li, Q. Li, J. Hu, J. Hu\n                      et al.\n                      , A survey on machine reading comprehension: Tasks, evaluation metrics and benchmark datasets, https:\/\/arxiv.org\/abs\/2006.11880."},{"key":"S0218194025500974BIB032","first-page":"311","volume-title":"Proc. 40th Annual Meeting on Association for Computational Linguistics","author":"Papineni K.","year":"2002"},{"key":"S0218194025500974BIB033","unstructured":"S. Ren, D. Guo, S. Lu, L. Zhou, S. Liu, D. Tang, N. Sundaresan, M. Zhou, A. Blanco and S. Ma, CodeBLEU: A method for automatic evaluation of code synthesis, https:\/\/arxiv.org\/abs\/2009.10297."},{"key":"S0218194025500974BIB034","unstructured":"E. Guerra, J. Yoder, M. Aniche and M. Gerosa, Fundamental test driven development step patterns, 2012, https:\/\/hillside.net\/plop\/2012\/papers\/proceedings\/papers\/16-guerra.pdf."},{"key":"S0218194025500974BIB035","doi-asserted-by":"publisher","DOI":"10.1145\/3672456"}],"container-title":["International Journal of Software Engineering and Knowledge Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.worldscientific.com\/doi\/pdf\/10.1142\/S0218194025500974","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,3,6]],"date-time":"2026-03-06T04:17:48Z","timestamp":1772770668000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.worldscientific.com\/doi\/10.1142\/S0218194025500974"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2026,1,5]]},"references-count":35,"journal-issue":{"issue":"06","published-print":{"date-parts":[[2026,5]]}},"alternative-id":["10.1142\/S0218194025500974"],"URL":"https:\/\/doi.org\/10.1142\/s0218194025500974","relation":{},"ISSN":["0218-1940","1793-6403"],"issn-type":[{"value":"0218-1940","type":"print"},{"value":"1793-6403","type":"electronic"}],"subject":[],"published":{"date-parts":[[2026,1,5]]}}}